Skip to content

Instantly share code, notes, and snippets.

View Knio's full-sized avatar

Tom Flanagan Knio

  • Palo Alto, CA, USA
View GitHub Profile
@Knio
Knio / rorate.sh
Created December 5, 2021 04:14
ffmpeg rotate
# https://ffmpeg.org/ffmpeg-filters.html#rotate
ffmpeg.exe -i RC_0010_211008155305.MP4 -vf "rotate = 3.0 , crop = 1920:1080" out10.mp4

Keybase proof

I hereby claim:

  • I am Knio on github.
  • I am knio (https://keybase.io/knio) on keybase.
  • I have a public key whose fingerprint is E4E8 7993 40DF B0CB C158 5E25 3409 E195 3A87 F456

To claim this, I am signing this object:

ffmpeg -ss 7:38 -t 0:5 -i INPUT.MP4 -codec copy CROP.MP4
#include <stdio.h>
#define N (12)
struct vec {
int x, y;
};
struct state {
struct vec p;
@Knio
Knio / pypy.txt
Last active August 29, 2015 13:57
Script started on Tue 25 Mar 2014 10:37:50 AM PDT
tom@zkpq:~$ cat test.py
def test1():
assert 'Hi\nThere' == \
'''Hi
There'''
tom@zkpq:~$ unix2dos test.py
#include <windows.h>
#define T for(x=0;x<4;x++)for(y=0;y<4;y++)if(((62194^P[i*4+r%4])>>(x+y*4))&1)
c;G(){c=kbhit()?((c=getch()),!c||c==224?256+getch():c):0;}q;p(int x,int y,int*s,
int k){SetConsoleCursorPosition(q,(COORD){2*x, y});SetConsoleTextAttribute(q,k);
puts(s);}short*P="òý¶¶òý¶¶’ô’ô’ô’ô’þ²Ô’þ²Ô2ôÒ´2ôÒ´ò¼²´²ü²¾’¶rü²6òÜ2¶ò|²–Òü";R;r;
t;i;B[80][24];px=4;py;w=1;v;n;x;y;nx;ny;nr;b;main(){q=GetStdHandle(-11);for(c=0;
c<408;c++)p(x,y,(B[x=c%17][y=c/17]=y-23?(!x|x>10?64:0):128)?"[]":" ",15);while(
w++){nx=px;ny=py;r=R;T p(px+x,py+y," ",0);if(w%5){G();c-328?:r++;c-336?:ny++;c-
331?:nx--;c-333?:nx++;}else ny++;v=0;T v|=B[nx+x][ny+y];v?:(px=nx,py=ny,R=r);T p
(px+x,py+y,"[]",t+5);if(!(w%5)&&v&128){T B[px+x][py+y]=128|(t+5);px=4;py=r=0;t=b
@Knio
Knio / encode.sh
Created September 27, 2012 05:13
Resize GOPRO images
dir=${1-.}
fps=${2-48}
if [ ! -s times.sub ]
then
find . -path "*/$dir/???GOPRO/GOPR????.JPG" -printf '%p\n' | sort | python `dirname $0`/subs.py > times.sub
fi
mplayer "mf://$dir/???GOPRO/GOPR????.JPG" -mf w=1920:h=1080:fps=$fps:type=jpg -ao null -benchmark -vo yuv4mpeg:file=>(x264 --demuxer y4m --crf 21 --preset fast --muxer mkv --output GOPRO.MKV -) -vf scale=1920:-3,flip,mirror,crop=1920:1080:0:0,pp=al -sub times.sub
@Knio
Knio / zfstrace
Created September 19, 2011 00:35
DTrace acceses to ZFS
#!/usr/sbin/dtrace -s
# pragma D option quiet
zfs_write:entry,
zfs_read:entry,
zfs_putpage:entry,
zfs_getpage:entry
{
self->ts = timestamp;
/* devnull/ioset.h - Asynchronous file descriptor event system.
* Copyright (c) 2011, Keith Plant. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
  1. Install some form of Solaris?
  2. Enable PAM Module
    1. Edit /etc/pam.conf and add this line:

      other password required pam_smb_passwd.so.1 nowarn

    2. Reset your passwords with passwd to generate PAM hashes