Skip to content

Instantly share code, notes, and snippets.

anatoly techtonik techtonik

Block or report user

Report or block techtonik

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@techtonik
techtonik / commmittery.py
Created Jul 9, 2017
Commit file versions using their timestamps as commit date
View commmittery.py
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))
View glretrace2gif
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 Sep 17, 2016
Go - show program name and arguments
View argi.go
// 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 Sep 6, 2016
Good practices for handling open source projects
View OpenSourceInc.md
@techtonik
techtonik / pp.go
Created Sep 3, 2016
Go - PP() - pretty printer for variables
View pp.go
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 May 6, 2017
Using Python with Far Manager
View PythonFar.md
View gist:b9523fc8ef841a1074afb75e2d9bfdf6
# 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 Jul 20, 2016
How to hack Google's depot_tools
View gist:2c741ee7dccbe86dbc5d8011641496d2
* [ ] 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 Jun 18, 2016
cross-platform package info
View pk.py
"""
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
Driver inheritance pattern - parent should print child's name
View README.md

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
You can’t perform that action at this time.