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
whatsonport () { | |
if [ $# -eq 1 ] | |
then | |
lsof -i :$1 | awk '{ print $2; }' | head -n 2 | grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox} -v PID | |
else | |
echo "Usage: whatsonport [port]" | |
fi | |
} |
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 { useCallback, useState } from 'react'; | |
// like `useState`, but also persists to local storage | |
export default function useLocalStorage<T>(key: string, initialValue: T): [T, (initialValue: T) => void] { | |
const [state, setState] = useState<T>(() => { | |
try { | |
const value = localStorage.getItem(key); | |
return value ? JSON.parse(value) : initialValue; | |
} catch (e) { | |
return initialValue; |
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
whatsonport () { | |
if [ $# -eq 1 ] | |
then | |
lsof -i :$1 | awk '{ print $2; }' | head -n 2 | grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox} -v PID | |
else | |
echo "Usage: whatsonport [port]" | |
fi | |
} |
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
module.exports = { | |
semi: true, | |
trailingComma: 'all', | |
singleQuote: true, | |
printWidth: 120, | |
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
#!/usr/bin/env bash | |
if [ $# -eq 0 ] | |
then | |
echo "usage: fu <grep pattern>" | |
exit 1 | |
fi | |
pattern=$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
#!/usr/bin/env bash | |
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=merged.pdf **.pdf | |
# jpg to pdf | |
ls *.JPG | xargs -I% convert % -quality 100 %.pdf | |
# compress them | |
ls *.pdf | xargs -I% gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=compressed_% % |
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
git checkout --orphan gh-pages | |
git subtree push --prefix dist origin gh-pages |
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
from urllib.request import urlretrieve | |
from os.path import isfile, isdir | |
from tqdm import tqdm | |
import sys | |
class DLProgress(tqdm): | |
last_block = 0 | |
def hook(self, block_num=1, block_size=1, total_size=None): | |
self.total = total_size |
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
Show hidden characters
[ | |
// Title Bar | |
{ | |
"class": "title_bar", | |
"attributes": ["file_medium_dark"], | |
"bg": ["background", 0, 0, 0, 0.25] | |
}, | |
// Side Bar | |
{ | |
"class": "sidebar_container", |
NewerOlder