This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
rm /tmp/fifo | |
mkfifo /tmp/fifo | |
mdir='/mnt/media/music/ /home/kevin/Desktop/some_sound/' | |
filter='(\.jpg|\.png|\.bmp|\.m3u|\.ini)' | |
function maybe_filter() { | |
while read -r -d $'\0' input; do | |
if [[ $input == *tons_of_video_game_music* ]]; then | |
if [ $RANDOM -lt 16384 ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Python implementation of Haskell's | |
sieve xs = sieve' xs Map.empty | |
where | |
sieve' [] table = [] | |
sieve' (x:xs) table = | |
case Map.lookup x table of | |
Nothing -> x : sieve' xs (Map.insert (x*x) [x] table) | |
Just facts -> sieve' xs (foldl reinsert (Map.delete x table) facts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; pro-tip: run "java -jar clojure.jar ai.clj >> ai.clj" for infinite fun! | |
(println ((fn [x y] (list (quote println) (list x (list (quote quote) x) (inc y)))) (quote (fn [x y] (list (quote println) (list x (list (quote quote) x) (inc y))))) 1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Repeatedly run a command if the system records a sound loud enough. | |
Requires PyAudio and Numpy. | |
Windows users: | |
win32 Python 2.7: http://www.python.org/ftp/python/2.7.3/python-2.7.3.msi | |
Numpy: http://sourceforge.net/projects/numpy/files/NumPy/1.7.1/numpy-1.7.1-win32-superpack-python2.7.exe/download | |
PyAudio: http://people.csail.mit.edu/hubert/pyaudio/packages/pyaudio-0.2.7.py27.exe | |
''' | |
import os |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; See revision version 1 for non-phantomJS version, setup phantomJS here: http://blog.zolotko.me/2012/12/clojure-selenium-webdriver-and-phantomjs.html | |
(use 'clj-webdriver.taxi) | |
(import 'org.openqa.selenium.phantomjs.PhantomJSDriver | |
'org.openqa.selenium.remote.DesiredCapabilities) | |
(use '[clj-webdriver.driver :only [init-driver]]) | |
; skip this section until 'lawl' comment | |
(use '[clj-webdriver.core :only [execute-script*]]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nnoremap <F2> :set invpaste paste?<CR> | |
imap <F2> <C-O><F2> | |
set pastetoggle=<F2> | |
set incsearch | |
set ignorecase | |
set smartcase | |
set scrolloff=2 | |
set wildmode=longest,list | |
set showcmd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import glob | |
files = glob.glob('*.js') | |
data = {} | |
for f in files: | |
file = open(f) | |
_ = file.readline() | |
data[f] = json.loads(file.read()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; calc.cljs | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(ns sevseg.calc) | |
(defn calc | |
"Expects a 4-item vector of booleans | |
representing a big-endian binary number. | |
Returns a 7-item map with keys prefix + num | |
corresponding to which segments of the display |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 1999-2016 Gentoo Foundation | |
# Distributed under the terms of the GNU General Public License v2 | |
# $Header: $ | |
EAPI=5 | |
inherit eutils autotools | |
DESCRIPTION="Common Lisp environment setup utility" | |
HOMEPAGE="https://github.com/roswell/roswell" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun reverse-string-c (string string-length) | |
(prog ((pos 0) (half (truncate (/ string-length 2)))) | |
START (if (= pos half) | |
(return string)) | |
(let ((swap-pos (- string-length pos 1))) | |
(rotatef (schar string pos) (schar string swap-pos))) | |
(incf pos) | |
(go START))) | |
(defun reverse-string (string) |