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
pip3 install virtualenv | |
python3.4 `which virtualenv` --python=`which python3.4` --no-site-packages env | |
mv env ~/.virtualenvs/ |
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
name: ww | |
init: Start | |
accept: Success | |
Start,a,_ | |
GoRight,a,X,>,> | |
Start,b,_ | |
GoRight,b,X,>,> | |
Start,a,Y | |
2GoLeft,a,Y,<,< |
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 | |
# https://gist.github.com/x2q/5124616#file-usbreset-c-L41 | |
/usr/bin/usbreset /dev/bus/usb/001/002 |
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
"""Convert a nondeterministic finite state automaton to a deterministic finite state automaton""" | |
from collections import OrderedDict | |
START = 'a' | |
STATES = { | |
'a': { | |
0: {'a'}, | |
1: {'a', 'b'} | |
}, |
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
int PRINT_TIMES = 0; | |
#define PRINT(x) PRINT_TIMES++; if (PRINT_TIMES <= 40) {std::cout << #x << " = " << x << "\n";} | |
#define PRINT_VECTOR(x) PRINT_TIMES++; if (PRINT_TIMES <= 40){std::cout << #x << " = "; print_vector(x);} | |
template <typename T> | |
void print_vector(T &v) { | |
std::cout << "{"; | |
bool first_value = true; | |
for (auto i = v.begin(); i != v.end(); ++i) { | |
if (first_value) { |
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 python | |
import os | |
import random | |
computers = ['albatrossi', 'broileri', 'dodo', 'drontti', 'emu', 'fasaani', 'flamingo', 'iibis', 'kakadu', 'kalkkuna', 'karakara', 'kasuaari', 'kiuru', 'kiwi', 'kolibri', 'kondori', 'kookaburra', 'koskelo', 'kuukkeli', 'lunni', 'moa', 'pelikaani', 'pitohui', 'pulu', 'ruokki', 'siira', 'strutsi', 'suula', 'tavi', 'tukaani', 'undulaatti', 'akaatti', 'akvamariini', 'ametisti', 'baryytti', 'berylli', 'fluoriitti', 'granaatti', 'hypersteeni', 'jade', 'jaspis', 'karneoli', 'korundi', 'kuukivi', 'malakiitti', 'meripihka', 'opaali', 'peridootti', 'rubiini', 'safiiri', 'sitriini', 'smaragdi', 'spektroliitti', 'spinelli', 'timantti', 'topaasi', 'turkoosi', 'turmaliini', 'vuorikide', 'zirkoni'] | |
os.system('ssh %s' % random.choice(computers)) |
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
for FILE in *.mp4 | |
do | |
echo $FILE | |
rm output.jpg | |
rm output.gif | |
ffmpeg -ss 30 -i $FILE -vf "select=gt(scene\,0.4)" -frames:v 1 -vsync vfr -vf fps=fps=1/60 out%02d.jpg | |
convert output.jpg -resize 900x900 ${FILE}.jpg | |
#rm palette.png | |
#ffmpeg -ss 20 -y -t 20 -i $FILE -vf fps=1,scale=640:-1:flags=lanczos,palettegen palette.png | |
#ffmpeg -ss 20 -t 20 -i $FILE -i palette.png -filter_complex "fps=1,scale=640:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif |
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 cache_get(url): | |
"""Request from API and cache the result""" | |
import hashlib | |
import json | |
import os | |
import requests | |
domain = url.split('/')[2].split('.')[-2] | |
path = os.path.join( | |
'.cache', |
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 example | |
import dispatch._, Defaults._ | |
import play.api.libs.json._ | |
object Hello extends App { | |
val svc = url("https://www.metaweather.com/api/location/search/?query=helsinki") | |
val response = Http.default(svc OK as.String) | |
val json = Json.parse(response()) | |
val woeid = (json \ 0 \ "woeid").get |
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
sftp -o ProxyCommand='ncat --proxy PROXIMO_URL:1080 --proxy-auth PROXIMO_USERNAME:PROXIMO_PASSWORD --proxy-type socks5 -w 4 %h %p' user@host:FILE |
OlderNewer