Skip to content

Instantly share code, notes, and snippets.

View techtonik's full-sized avatar

anatoly techtonik techtonik

View GitHub Profile
@techtonik
techtonik / commmittery.py
Created July 9, 2017 12:35
Commit file versions using their timestamps as commit date
import os
from shellrun import run
from datetime import datetime
hist = sorted([name for name in os.listdir('.') if name.startswith('appvey') and name != 'appvey.py'])
print('\n'.join(hist))
for f in hist:
tstamp = datetime.fromtimestamp(os.path.getmtime(f))
run('copy {} appvey.py'.format(f))
glretrace.exe -s - input.trace | ffmpeg -r 75 -f image2pipe -vcodec ppm -i pipe: -r 25 -qscale 3.1 -y output.ogg
# get palette
ffmpeg -y -i output.ogg -vf fps=10,scale=320:-1:flags=lanczos,palettegen palette.png
# write gif
ffmpeg -i output.ogg -i palette.png -filter_complex "fps=10,scale=320:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif
# links:
# - https://en.wikibooks.org/wiki/OpenGL_Programming/Video_Capture
# - https://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality/556031#556031
@techtonik
techtonik / argi.go
Last active September 17, 2016 00:34
Go - show program name and arguments
// go run argi.go
package main
import "os"
import "fmt"
func main() {
fmt.Println("prog:", os.Args[0])
if len(os.Args) > 1 {
fmt.Println("args:", os.Args[1:])
@techtonik
techtonik / OpenSourceInc.md
Last active September 6, 2016 06:21
Good practices for handling open source projects
@techtonik
techtonik / pp.go
Created September 3, 2016 06:32
Go - PP() - pretty printer for variables
package pp
import (
"fmt"
"encoding/json"
)
// Pretty print structures. Uses "encoding/json" to
// convert nested structure to indented string.
func PP(v interface{}) {
@techtonik
techtonik / PythonFar.md
Last active October 29, 2019 21:40
Using Python with Far Manager
# prepare pager
less = 'less'
if IS_WIN:
with open(ROOT + '\\git.bat') as r:
for line in r:
start = line.find('%~dp0')
if start != -1:
GIT_DIR = line[start+5:line.find('\cmd')]
less = ROOT + '\\' + GIT_DIR + '\\usr\\bin\\less'
@techtonik
techtonik / gist:2c741ee7dccbe86dbc5d8011641496d2
Last active July 20, 2016 12:35
How to hack Google's depot_tools
* [ ] See branch name on Rietveld
* [ ] Fetch branch from Rietveld
* [ ] git sync instead of (rebase-update)
* [ ]
>git rebase-update
Fetching origin
remote: Counting objects: 1110, done
remote: Finding sources: 100% (30/30)
@techtonik
techtonik / pk.py
Last active June 18, 2016 16:47
cross-platform package info
"""
packaging for humans (tm)..
humans are easily overloaded with information, so
this should be the intuitive way to express and
solve what humans want.
001 get what package does
pk show <name>
@techtonik
techtonik / README.md
Last active May 21, 2016 07:40
Driver inheritance pattern - parent should print child's name

See getname.py and try to implement the same in C++ with and without using templates.

$ python getname.py 
Unknown
Specific

$ g++ -std=c++14 -O2 -Wall -pedantic main.cpp && ./a.out
Unknown

Specific