Skip to content

Instantly share code, notes, and snippets.

View phongsathorn1's full-sized avatar
🙂
Be Smile

Phongsathorn Kittiworapanya phongsathorn1

🙂
Be Smile
  • TMBThanachart Bank (ttb bank)
  • Krung Thep Mahanakhon Amon Rattanakosin Mahinthara Ayuthaya Mahadilok Phop Noppharat Ratchathani Burirom Udomratchaniwet Mahasathan Amon Piman Awatan Sathit Sakkathattiya Witsanukam Prasit (Bangkok), Thailand
  • 11:28 (UTC +07:00)
  • LinkedIn in/phongsathorn1
View GitHub Profile
I am attesting that this GitHub handle phongsathorn1 is linked to the Tezos account tz1RgHposxat6hFXvSx5CaPNyZxggwYvXjpY for tzprofiles
sig:edsigts6gP8oDjDygCRf3Ly1zppp9oKVg9uPAgWM6DpLPoTwMGis9evmuWWUr9CikyAhESh6grG6FVFvk5QfTpchjQF9LoK7WiY
@phongsathorn1
phongsathorn1 / Local PR test and merge.md
Created February 12, 2021 16:01 — forked from adam-p/Local PR test and merge.md
Testing a pull request, then merging locally; and avoiding TOCTOU

It's not immediately obvious how to pull down the code for a PR and test it locally. But it's pretty easy. (This assumes you have a remote for the main repo named upstream.)

Getting the PR code

  1. Make note of the PR number. For example, Rod's latest is PR #37: Psiphon-Labs/psiphon-tunnel-core#37

  2. Fetch the PR's pseudo-branch (or bookmark or rev pointer whatever the word is), and give it a local branch name. Here we'll name it pr37:

$ git fetch upstream pull/37/head:pr37
@phongsathorn1
phongsathorn1 / apple-music-story.html
Last active April 25, 2021 10:53
HTML template for Siri Shortcut for share a song from Apple Music to Instagram Story. (Before iOS 13.5, it doesn't have the option to share a song to Instagram Story)
<head>
<style type="text/css">
@media print {
html {
transform: scale(0.5);
transform-origin: 0 0;
}
}
.story {
cd opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=$cwd/installation/OpenCV-4.1.1 \
-D WITH_CUDA=ON \
-D WITH_QT=OFF \
-D WITH_OPENGL=ON \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
A backup of http://sites.google.com/site/redcodenl/creating-shazam-in-java-1 just in case
Why is this necessary? Read http://sites.google.com/site/redcodenl/patent-infringement
Please fork, tweet about, etc.
----
Creating Shazam in Java
A couple of days ago I encountered this article: How Shazam Works
This got me interested in how a program like Shazam works… And more importantly, how hard is it to program something similar in Java?
@phongsathorn1
phongsathorn1 / install.sh
Created August 17, 2018 09:18
install Puppeteer libs
sudo apt-get install gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
@phongsathorn1
phongsathorn1 / repo.sh
Created August 17, 2018 07:21
Enable all Ubuntu repositories (main, universe, restricted, multiverse)
sudo add-apt-repository main
sudo add-apt-repository universe
sudo add-apt-repository restricted
sudo add-apt-repository multiverse
sudo apt update
@phongsathorn1
phongsathorn1 / structure-of-tweepy-status-object.json
Created August 13, 2018 14:35
the structure of the Status object of Tweepy
/* json.dumps(StatusObject._json) */
{
"created_at": "Thu Jul 28 00:08:39 +0000 2016",
"in_reply_to_status_id": null,
"id_str": "758454081656467456",
"retweeted": false,
"entities": {
"hashtags": [
{
@phongsathorn1
phongsathorn1 / dnscheck.sh
Last active August 17, 2018 07:18 — forked from j-manu/gist:1376161
Check dns response time
#!/bin/bash
isp=$(dig +noall +stats 2>&1 | awk '$2~/^SERVER:$/{split($3,dnsip,"#");print dnsip[1]}');
m="-------------------------------------------------------------------------------";
s=" ";
h="+${m:0:25}+${m:0:12}+${m:0:12}+${m:0:12}+${m:0:12}+${m:0:12}+${m:0:12}+${m:0:12}+${m:0:12}+";
header=("Domain${s:0:23}" "Your ISP${s:0:10}" "Google${s:0:10}" "8.8.4.4${s:0:10}" "1.1.1.1${s:0:10}" "1.0.0.1${s:0:10}" "4.2.2.2${s:0:10}" "OpenDNS${s:0:10}" "DNS Adv.${s:0:10}");
echo "${h}";
echo "| ${header[0]:0:23} | ${header[1]:0:10} | ${header[2]:0:10} | ${header[3]:0:10} | ${header[4]:0:10} | ${header[5]:0:10} | ${header[6]:0:10} | ${header[7]:0:10} | ${header[8]:0:10} | ${header[9]:0:10}";
echo "${h}";
for i in "lifehacker.com" "facebook.com" "manu-j.com" "reddit.com" "tb4.fr" "bbc.co.uk" "blognone.com" "pantip.com" "twitter.com" "reg.kmitl.ac.th";
@phongsathorn1
phongsathorn1 / Alphabet Sequence.py
Last active July 6, 2018 10:54
Pre-Programming On-Site Quiz #2 - Answer
def main():
alphabet = input()
all_alphabet = ""
for i in range(26):
all_alphabet += chr(65 + i)
for i in range(26):
all_alphabet += chr(97 + i)