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
/** | |
* Modified by isobar on 04/01/19. | |
* | |
* Created by isee15 on 15/1/14. | |
*/ | |
/* | |
Usage: | |
var converter = new LunarSolarConverter(); | |
var solar = new Solar(); | |
solar.solarYear = 1985; |
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
#!/bin/sh | |
# | |
# Copyright 2018 isobar. All Rights Reserved. | |
# | |
# Usage: | |
# ./mk-py-pkg.sh MyImgPy wwwins [email protected] | |
# | |
echo '>>>>> python package init <<<<<' | |
if [ -z "$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
# load a python file | |
%load teeth-whitening.py | |
# setup sys args for argparse | |
sys.argv = ["teeth-whitening.py", "data/shape_predictor_68_face_landmarks.dat", "faces/Cara_Delevingne.png"] | |
# debug | |
%debug main() | |
ipdb> s | |
ipdb> n |
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
*/5 * * * * /usr/local/bin/autossh.sh | |
#20 0 * * * find /home/isobar/upload -type f -mtime +0 -exec mv '{}' /mnt/data/backup/ftp/ \; | |
#22 0 * * * mkdir /mnt/data/backup/public/$(date +\%Y\%m\%d);find /home/xxx/intel-8th/public -mindepth 1 -type d -mtime +0 -exec mv '{}' /mnt/data/backup/public/$(date +\%Y\%m\%d)/ \; | |
31 0 * * * mkdir /mnt/data/backup/ftp/$(date +\%Y\%m\%d);mv /home/isobar/upload/*.mp4 /mnt/data/backup/ftp/$(date +\%Y\%m\%d)/; | |
41 0 * * * mkdir /mnt/data/backup/public/$(date +\%Y\%m\%d);mv /home/xxx/intel-8th/public/* /mnt/data/backup/public/$(date +\%Y\%m\%d)/; | |
@reboot /usr/bin/forever --workingDir /home/xxx/intel-8th start /home/xxx/intel-8th/src/app.js |
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
# copy a-*.ejs to d-*.ejs | |
$ for f in a-*.ejs; do cp $f d${f: 1}; done; | |
cp a-1.ejs d-1.ejs | |
cp a-2.ejs d-2.ejs | |
cp a-3.ejs d-3.ejs | |
cp a-4.ejs d-4.ejs | |
# copy loop_*.mp3 to loop_*.wav | |
$ for f in loop_*.mp3; do echo $f ${f:0:-4}.wav; done; | |
loop_1.mp3 loop_1.wav |
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
#!/bin/bash | |
# | |
# add the following job into crontab | |
# */5 * * * * /usr/local/bin/autossh.sh | |
IP="1.1.1.1" | |
/bin/ping -c 3 $IP > /dev/null | |
if [ $? != 0 ] | |
then |
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
# gen id_rsa/id_rsa.pub in .ssh/ | |
ssh-keygen -t rsa | |
# on remote server | |
cat id_rsa.pub >> .ssh/authorized_keys | |
chmod 600 authorized_keys | |
# ssh login remote server | |
ssh -i .ssh/id_rsa [email protected] | |
# port forward 8554 to 192.168.1.100:80 | |
ssh -g -L 8554:localhost:80 -f -N [email protected] | |
# reverse ssh tunnel |
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
# POST multipart/form-data with a file upload | |
curl --request POST --url https://postman-echo.com/post -F "foo1=bar1" -F "foo2=bar2" -F "image=@/Users/isobar/Downloads/radar.jpg" | |
## POST multipart/form-data with json string | |
curl --request POST --url https://postman-echo.com/post -F "json=$jsonString" | |
# POST on windows | |
curl --request POST --url https://xxxxxx.ngrok.io/upload/ -F "filename=@d:\Data\My documents\Processing\mySample_http_post\test.tif" | |
# POST binary data with a file upload |
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
# video to image by fps | |
ffmpeg -i in.mp4 -vf fps=1/5 pic%03d.png | |
# video to image by input seeking | |
ffmpeg -ss 5 -i in.mp4 -frames:v 1 pic.png | |
# https://trac.ffmpeg.org/wiki/Seeking | |
# cut from 00:05 to 00:10 | |
ffmpeg -ss 00:05 -i in.mp4 -t 00:05 -c copy -copyts out.mp4 |
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
/* | |
* Promise and async/await function | |
*/ | |
'use strict'; | |
// type-1 | |
// function(resolve) {} | |
function action1(msg) { | |
return new Promise( | |
function(resolve) { |