Skip to content

Instantly share code, notes, and snippets.

@LeonB
LeonB / serve.sh
Created July 30, 2012 21:03
One-line bash http server
:;while [ $? -eq 0 ];do nc -vlp 8080 -c'(r=read;e=echo;$r a b c;z=$r;while [ ${#z} -gt 2 ];do $r z;done;f=`$e $b|sed 's/[^a-z0-9_.-]//gi'`;h="HTTP/1.0";o="$h 200 OK\r\n";c="Content";if [ -z $f ];then($e $o;ls|(while $r n;do if [ -f "$n" ]; then $e "<a href=\"/$n\">`ls -gh $n`</a><br>";fi;done););elif [ -f $f ];then $e "$o$c-Type: `file -ib $f`\n$c-Length: `stat -c%s $f`";$e;cat $f;else $e -e "$h 404 Not Found\n\n404\n";fi)';done
@LeonB
LeonB / ruby-2.0.0-p451-readline.patch
Last active May 12, 2016 09:06
ruby 2.0.0-p451 readline patch
diff --git ext/readline/extconf.rb ext/readline/extconf.rb
index 4920137..8e81253 100644
--- ext/readline/extconf.rb
+++ ext/readline/extconf.rb
@@ -19,6 +19,10 @@ def readline.have_func(func)
return super(func, headers)
end
+def readline.have_type(type)
+ return super(type, headers)
@LeonB
LeonB / cc.py
Last active August 29, 2015 14:17
python wrapperscript for stdin bug winegcc
#!/usr/bin/env python
from subprocess import Popen, PIPE, STDOUT
import os
import sys
import tempfile
import re
if not sys.stdin.isatty():
stdin = sys.stdin.read()
@LeonB
LeonB / README.md
Last active August 29, 2015 14:18
irsdk_broadcastMsg test

Compile with i686-w64-mingw32-g++ -static-libgcc -static test.cpp
Run with /opt/iracing/bin/wine --bottle default a.exe

package main
import (
"bytes"
"fmt"
"log"
"net"
"os"
"os/exec"
"unsafe"
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by git-commit with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, make this file executable.
# This is slightly modified from Andrew Morton's Perfect Patch.
#!/bin/bash
# Tested with ffmpeg 2.8.4
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
echo "Please provide audio file, video file and output file"
echo "For example: audio.mp3 video.mp4 output.mp4"
exit
fi