Skip to content

Instantly share code, notes, and snippets.

View ghadishayban's full-sized avatar

Ghadi Shayban ghadishayban

View GitHub Profile
@ghadishayban
ghadishayban / vhsrip.sh
Created November 5, 2012 14:43
Rip an old VHS using avconv and video4linux2
#!/bin/bash
# expects filename as first arg
# Using jack highly recommended over alsa
# Make sure you set up real time priorities
pasuspender -- qjackctl &
echo Before pressing play, go into the jack GUI and \
connect the source to the sink.
@ghadishayban
ghadishayban / Coder.scala
Created May 28, 2012 05:40 — forked from swannodette/Coder.scala
phone_code.clj
package demo
class Coder(words: List[String]) {
private val mnemonics = Map(
'2' -> "ABC", '3' -> "DEF", '4' -> "GHI", '5' -> "JKL",
'6' -> "MNO", '7' -> "PQRS", '8' -> "TUV", '9' -> "WXYZ")
private val charCode: Map[Char, Char] =
for ((digit, str) <- mnemonics; letter <- str) yield letter -> digit
@ghadishayban
ghadishayban / gist:2636413
Created May 8, 2012 15:37
Lazily distinct list
(defn lazily-distinct [coll]
"Returns a lazy distinct list of possibly infinite collection.
Does not realize the whole collection."
(letfn [(lazystep [seen l]
(lazy-seq
(when (seq l)
(loop [next-item (first l) lazy-list (rest l)]
(if (get seen next-item)
(recur (first lazy-list) (rest lazy-list))
(cons next-item (lazystep (conj seen next-item)
@ghadishayban
ghadishayban / llp.server.cljs
Created December 17, 2011 22:06
HL7 LLP wire protocol receiver, ClojureScript on node.js. No ACKs yet
(ns llp.server
(:require [cljs.nodejs :as node]
[clojure.string :as str]))
(def net (node/require "net"))
(def events (node/require "events"))
(defn bufs->string [bufs]
(loop [acc ""
rst bufs]