This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"arrowParens": "avoid", | |
"trailingComma": "none", | |
"jsxBracketSameLine": true, | |
"printWidth": 100, | |
"singleQuote": true, | |
"semi": false, | |
"tabWidth": 2 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# png to jpg with width 100 | |
for i in *.png; do sips -s format jpeg -s formatOptions 90 -Z 100 $i --out "${i%png}jpg";done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// remove from array, no seq | |
// https://jsperf.com/array-remove-by-index | |
var arr = [1,2,3] | |
var index = arr.indexOf(2) | |
arr[index] = arr[arr.length - 1] | |
arr.pop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
1. bookmark any page in mobile | |
2. edit bookmark into below js as "eruda" | |
3. go to desired debug page | |
4. url bar tap "erude" and click the bookmarked link | |
*/ | |
javascript:(function () { var script = document.createElement('script'); script.src="//cdn.jsdelivr.net/npm/eruda"; document.body.appendChild(script); script.onload = function () { eruda.init() } })(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# download as mp4, playlist also | |
function youtube-dl-mp4() { | |
youtube-dl -f "[height <=? 720][tbr>500]" --yes-playlist $1 | |
} | |
# download as mp3 | |
function youtube-dl-mp3() { | |
youtube-dl -x --audio-format mp3 --add-metadata $1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# save disk space, screen no need png | |
defaults write com.apple.screencapture type jpg;killall SystemUIServer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"fmt" | |
"io" | |
"io/ioutil" | |
"net/http" | |
"strings" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function findgo() { | |
find $GOPATH/src -mindepth 3 -maxdepth 3 -type d -exec ls -ld "{}" \; | grep $1 | awk '{ print $9 }' | nl | |
} | |
findgo gogo | |
function cdgo() { | |
r=$(findgo $1) | |
echo $r | |
printf 'cd to ? > ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package dropbox | |
import ( | |
"bytes" | |
"encoding/json" | |
"errors" | |
"io/ioutil" | |
"log" | |
"net/http" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.Iterator; | |
import java.util.LinkedHashMap; | |
import java.util.List; | |
import java.util.Map; | |
public class ShannonFano { |