Skip to content

Instantly share code, notes, and snippets.

View Leonidas-from-XIV's full-sized avatar

Marek Kubica Leonidas-from-XIV

View GitHub Profile
@katef
katef / hattifatteners.awk
Created October 23, 2020 22:48
hattifatteners.awk
#!/usr/bin/awk -f
function hoop(h, w) {
printf("l 0 %d ", -h);
printf("c 0 -%u, %u -%u, %u 0 ", w, w, w, w);
printf("l 0 %d", +h);
}
function hand(x, h, o, l) {
printf("<g transform='translate(%d.5 %d)'>\n", x, h);
@mike1703
mike1703 / optimize-sqlite.sh
Created October 31, 2017 07:04
finds all sqlite databases in the current folder (and subfolders) and executes sqlite3 $FILE "VACUUM;" on all databases
#!/bin/bash
find -type f \( -name "*.db" -or -name "*.sqlite" \) -print0 | while read -d $'\0' FILE
do
TYPE=`file "$FILE" | grep -i sqlite`
[ -z "$TYPE" ] && continue # this is not an sqlite db
PRESIZE=`ls -sh "$FILE" | cut -f 1 -d " "`
PRESIZEFULL=`ls -s "$FILE" | cut -f 1 -d " "`
sqlite3 "$FILE" "VACUUM;"
POSTSIZE=`ls -sh "$FILE" | cut -f 1 -d " "`
(*
ocamlbuild \
-pkg containers \
-pkg lwt \
-pkg yojson \
-pkg conduit.lwt-unix \
-pkg nocrypto \
-pkg nocrypto.unix \
-pkg websocket.lwt \
-cflags "-w A-4-40-41-42-44" \
module Natl =struct
type z = Nil_z
type 'a succ = Nil_succ
end
open Natl
type _ t =
| Nil: <f:'a; t:'a; dim:z > t
| Cons:
'elt * <f:'ty; t:'ret; dim:'d > t -> <f: 'elt -> 'ty; t:'ret; dim:'d succ> t
@samaaron
samaaron / Reich Phase - Overtone
Last active December 26, 2019 20:29
Steve Reich's Piano Phase - Sonic Pi vs Overtone
(ns overtone.examples.compositions.piano-phase
(:use overtone.live
overtone.inst.sampled-piano))
;; Steve Reich's Piano Phase
(def piece [:E4 :F#4 :B4 :C#5 :D5 :F#4 :E4 :C#5 :B4 :F#4 :D5 :C#5])
(defn player
[t speed notes]
(ns sliders)
(defmacro slider [l]
(let [dashes (vec (repeat l "-"))]
`(do ~@(map (fn [i]
`(defn
~(symbol (clojure.string/join (assoc dashes i "*")))
[]
~(/ i (- l 1))))
(range l)))))
@choppsv1
choppsv1 / tmux-24.diff
Last active December 21, 2018 15:25
True color (24-bit) terminal support for tmux-1.9a and tmux-2.0
This diff is a modified version of a diff written by Arnis Lapsa.
[ The original can be found here: https://gist.github.com/ArnisL/6156593 ]
This diff adds support to tmux for 24-bit color CSI SRG sequences. This
allows terminal based programs that take advantage of it (e.g., vim or
emacs with https://gist.github.com/choppsv1/73d51cedd3e8ec72e1c1 patch)
to display 16 million colors while running in tmux.
The primary change I made was to support ":" as a delimeter as well
@namuol
namuol / INSTALL.md
Last active July 24, 2023 11:53
rage-quit support for bash

rage-quit support for bash

HOW TO INSTALL

Put flip somewhere in your $PATH and chmod a+x it.

Copy fuck into ~/.bashrc.

@datagrok
datagrok / ergodox.md
Last active January 14, 2019 07:45
Reflections on my ErgoDox keyboard
@danielsz
danielsz / pushState.cljs
Last active July 15, 2016 15:13
PushState (via Html5History from google closure) with secretary, a client-side routing library for clojurescript. Allows to map absolute urls with routes without the hash-bang hackery.
(def history (Html5History.))
(.setUseFragment history false)
(.setPathPrefix history "")
(.setEnabled history true)
(let [navigation (listen history EventType/NAVIGATE)]
(go
(while true
(let [token (.-token (<! navigation))]
(secretary/dispatch! token)))))