This file contains hidden or 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
| FILE="myfile.txt" | |
| split -l $(( $(wc -l "$FILE" | cut -d" " -f1) / 2 )) "$FILE" "$FILE_split_" |
This file contains hidden or 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
| # input current mp4 files, output: merged.mp4 | |
| ls *mp4 | sed "s#^#file '#g" | sed "s#\$#'#g" > tm.txt && ffmpeg -f concat -safe 0 -i tm.txt -c copy merged.mp4 && rm tm.txt |
This file contains hidden or 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
| crt_to_pem = function() { | |
| openssl x509 -in "$1.crt" -out "$1.pem" -outform PEM | |
| } |
This file contains hidden or 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 cpdf() { | |
| /usr/bin/gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=$1.compress.pdf $1 | |
| } |
This file contains hidden or 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
| for i in {0..20} | |
| do | |
| yes > /dev/null & | |
| done; sleep 120; kill -9 $(pidof yes) |
This file contains hidden or 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
| def pmap(func, iter, pool_size=4): | |
| """ Like pythons map() function but parallel """ | |
| from multiprocessing.dummy import Pool | |
| return Pool(pool_size).map(func, iter) |
This file contains hidden or 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
| find . -name "*.tex" -exec cat {} \; | sed "s# #\n#g" | sed "s#\t##g" | sort | grep '^\\' | grep -v '\\end' | uniq -c | sort -nr | head -n100 |
This file contains hidden or 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
| # Based on http://codereview.stackexchange.com/questions/135366/python-iban-validation | |
| import string | |
| def is_iban(unchecked_iban): | |
| LETTERS = {ord(d): str(i) for i, d in enumerate(string.digits + string.ascii_uppercase)} | |
| def _number_iban(iban): |
This file contains hidden or 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
| sudo apt-get update | |
| sudo apt-get install octave git libmatio2 libprotobuf-dev protobuf-compiler nvidia-cuda-toolkit octave-image | |
| git clone https://github.com/luanfujun/deep-photo-styletransfer.git | |
| cd deep-photo-styletransfer/ | |
| bash models/download_models.sh | |
| cd .. | |
| git clone https://github.com/torch/distro.git ~/torch --recursive | |
| cd ~/torch; bash install-deps; | |
| ./install.sh |
This file contains hidden or 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 cpdf() { | |
| /usr/bin/gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=$1.compress.pdf $1 | |
| } |