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 | |
seconds=120 | |
if [ ! -d "$HOME/watcher" ]; then | |
mkdir "$HOME/watcher" | |
fi | |
echo "Taking screenshots, the plan is to go like that for an hour" | |
for counter in $(seq -f "%05g" 0 $seconds) | |
do |
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
# The reference for the implementation is this link | |
# https://developers.google.com/maps/documentation/utilities/polylinealgorithm?hl=en | |
# it decodes and encodes some test values, have fun playing with it. | |
def encode_coordinate(value): | |
value = int(value * 1E5) | |
value = ~(value << 1) if value < 0 else (value << 1) | |
res = [] |
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 | |
secs=`exiftool "${1}" |grep "Media Duration"|cut -d':' -f4 -f3 -f2 |sed 's/:/ /g'| awk '{print ((($1*60)+$2)*60)+$3}'` | |
tmp=`dd if=/dev/urandom bs=4098 count=200 of=/dev/stdout|shasum|head -c 10; echo` | |
ffmpeg -i "${1}" -vf fps=1/$(($secs/14)) $tmp%04d.png | |
montage -geometry 480x270+2+2 `ls $tmp*.png` -tile 4x4 result_$tmp.png | |
rm $tmp*.png | |
noxt=`a="${1}";IFS=".";set $a;echo $1` | |
mv "result_$tmp.png" "$noxt.png" |
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
if [ -z "${1}" ] | |
then | |
passlen=32 | |
else | |
passlen=${1} | |
fi | |
dd if=/dev/urandom bs=4098 count=200 of=/dev/stdout|base64|head -c $passlen ; echo |
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 collections import Counter | |
import os.path | |
def get_tree(d): | |
retList = [] | |
os.chdir(d) | |
for path,dirs,files in os.walk("."): | |
for fn in files: | |
retList.append(os.path.join(path,fn)) | |
os.chdir("..") |
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/local/bin/node | |
var spawn = require('child_process').spawn; | |
function downloadVid(vidURL){ | |
process.stdout.write('\nyoutube-dl -f 18 ' + vidURL.split("&")[0] + "\n"); | |
yt = spawn("youtube-dl",["-f","18",vidURL.split("&")[0]]); | |
yt.stdout.on('data', function (data) { | |
process.stdout.write(data); | |
}); | |
yt.on('close', function (code) { | |
process.stdout.write('child process exited with code ' + code + "\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
if [ -z "${1}" ] | |
then | |
u=`pbpaste` | |
else | |
u=${1} | |
fi | |
co=`curl -s $u | grep "<title>"` | |
co="${co/<title>/}" | |
co="${co/<\/title>/ $u}" | |
echo $co |
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 sys, time | |
def inc(i): | |
return i+1 | |
def dec(i): | |
return i-1 | |
func = [inc, dec] | |
s = input("Say something: ") |
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
def check_range(frm,to,trgt): | |
return 1 if frm<=trgt and to>=trgt else 0 | |
def lower_character(c): | |
comp = check_range(ord('A'),ord('Z'),c) | |
return (comp<<5)|c if comp==1 else c | |
def upper_character(c): | |
comp = check_range(ord('a'),ord('z'),c) | |
return c&((comp<<5)^0x7f) if comp==1 else c |
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 math | |
def stringNorm(s): | |
odd = 0 | |
even = 0 | |
for c in s: | |
if not c==" ": | |
if ord(c)%2==0: | |
even+=math.pow(ord(c),2) | |
else: |