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
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <title>#dmc Dancing Snowman by Teemu</title> | |
| <style> | |
| html, | |
| body { | |
| margin: 0; | |
| padding: 0; |
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
| alias gpu='git push -u origin $(git symbolic-ref --short HEAD)' | |
| alias gitbackup='git checkout -b backup/`git rev-parse --abbrev-ref HEAD`/`date +%Y%m%d-%H%M%S` && git checkout -' | |
| alias acommit='git add -A :/ && git commit -a' | |
| alias changedfiles='git diff --name-status master..`git rev-parse --abbrev-ref HEAD`' | |
| alias rebasemaster='git checkout master && git pull && git checkout - && git rebase master' | |
| alias updatebranch='git fetch && git reset --hard origin/$(git rev-parse --abbrev-ref HEAD)' | |
| alias changed='git diff HEAD' | |
| alias gitbranch="git for-each-ref --color=always --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))' | tail -15" | |
| killport () { | |
| if [ -z "`lsof -i tcp:${1:-5000}`" ] |
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
| import click | |
| import os | |
| import glob | |
| @click.command() | |
| @click.option('--dry/--no-dry', default=False) | |
| @click.argument('root_path', type=click.Path()) | |
| @click.argument('replace_strings', nargs=-1) | |
| def replace_all(dry, root_path, replace_strings): |
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
| from sh import git, open | |
| branch = git('rev-parse', '--abbrev-ref', 'HEAD').strip() | |
| location = git('remote', 'get-url', 'origin').split('[email protected]:')[1].split('.git')[0] | |
| url = 'https://github.com/%s/compare/%s?expand=1' % ( | |
| location, | |
| branch | |
| ) | |
| open(url) |
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
| #!/usr/local/bin/python3 | |
| from pycookiecheat import chrome_cookies | |
| from requests_html import HTMLSession | |
| import requests | |
| import click | |
| import time | |
| import pync | |
| @click.command() |
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
| sftp -o ProxyCommand='ncat --proxy PROXIMO_URL:1080 --proxy-auth PROXIMO_USERNAME:PROXIMO_PASSWORD --proxy-type socks5 -w 4 %h %p' user@host:FILE |
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
| 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 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 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 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 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 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
| #!/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)) |
NewerOlder