Skip to content

Instantly share code, notes, and snippets.

@aktau
aktau / ffmpeg-interlace-test.sh
Last active October 28, 2023 14:26
ffmpeg detect interlacing
#!/bin/bash
# for a blogpost on this, check: http://www.aktau.be/2013/09/22/detecting-interlaced-video-with-ffmpeg/
# detect interlacing with the ffmpeg "idet" filter, the longer
# you let this run, the better, though it's never 100% accurate
# flags:
# -an = discard audio, we don't need it
# -f rawvideo = output raw video
@aktau
aktau / avg.scala
Created July 29, 2013 08:38
benchmark averaging methods
def movingRunningApprox(window: Int, l: Seq[Int]) = {
val N = window
val seedrun = l.take(N)
var avg = seedrun.sum / seedrun.length
println(l)
val xs = l map { el =>
val (pre,dec,inc) = (avg,avg/N,el/N)
avg = avg - avg/N + el/N
@aktau
aktau / imessage
Last active June 11, 2023 20:30
Send iMessage from the commandline
#!/bin/sh
if [ "$#" -eq 1 ]; then stdinmsg=$(cat); fi
exec <"$0" || exit; read v; read v; read v; exec /usr/bin/osascript - "$@" "$stdinmsg"; exit
-- another way of waiting until an app is running
on waitUntilRunning(appname, delaytime)
repeat until my appIsRunning(appname)
tell application "Messages" to close window 1
delay delaytime
end repeat
@aktau
aktau / nibless.m
Created January 14, 2014 23:00
nibless window creation in cocoa/objc
#import <AppKit/AppKit.h>
// clang -o nibless nibless.m -framework AppKit
@interface TestView : NSView <NSWindowDelegate> { }
-(void)drawRect:(NSRect)rect;
@end
@implementation TestView
-(void)drawRect:(NSRect)rect {
#!/usr/bin/env bpftrace
/**
* See the implementations of forksnoop.bt and execsnoop.bt. This is just a
* combination of those two.
*/
#include <linux/sched.h>
BEGIN {
From b285ac6b4d1374917d3f26879b2ed1a29f23eea3 Mon Sep 17 00:00:00 2001
From: Nicolas Hillegeer <nicolas@hillegeer.com>
Date: Fri, 24 Jun 2022 01:20:47 -0700
Subject: [PATCH] tui: debugging help for terminal state (DO NOT MERGE)
---
src/nvim/tui/tui.c | 518 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 518 insertions(+)
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c
diff --git a/usr/local/google/home/aktau/tmp/TERM.readable.xterm-256color b/usr/local/google/home/aktau/tmp/TERM.readable.hterm-256color
index 623fbfdb5..826ad3e9f 100644
--- a/usr/local/google/home/aktau/tmp/TERM.readable.xterm-256color
+++ b/usr/local/google/home/aktau/tmp/TERM.readable.hterm-256color
@@ -1,4 +1,4 @@
-name = xterm with 256 colors
+name = Chromium hterm with xterm 256-colors
unibi_auto_left_margin: 0
unibi_auto_right_margin: 1
unibi_no_esc_ctlc: 0
diff --git a/tmp/zshhttmNa b/tmp/zsh3ggAug
index 1950aed..be145ed 100644
--- a/tmp/zshhttmNa
+++ b/tmp/zsh3ggAug
@@ -1,21 +1,18 @@
-# Reconstructed via infocmp from file: /lib/terminfo/x/xterm-256color
-xterm-256color|xterm with 256 colors,
+# Reconstructed via infocmp from file: /usr/share/terminfo/h/hterm
+hterm|Chromium hterm,
am,
@aktau
aktau / mysql.sh
Last active June 22, 2022 14:01
Handy mysql commands and tips
#!/bin/sh
set -e
set -u
# I'm just getting acquainted with mysql so cut me some slack ;)
## check the size of the db
# source: http://stackoverflow.com/questions/1733507/how-to-get-size-of-mysql-database
# per schema
@aktau
aktau / dkms.conf.sh
Created November 13, 2015 11:48
/var/lib/dkms/zfs/0.6.5.2/build/dkms.conf
BUILD_DEPENDS[0]="spl"
AUTOINSTALL="yes"
PACKAGE_NAME="zfs"
PACKAGE_VERSION="0.6.5.2"
PRE_BUILD="configure
--prefix=/usr
--with-config=kernel
--with-linux=$(moddir=`echo ${kernel_source_dir/%build/.}`;
if [ -e $moddir/source/include/linux/input ]; then
echo $moddir/source