Skip to content

Instantly share code, notes, and snippets.

@wari
wari / chope.go
Last active September 16, 2015 10:33
// Package main provides a way to chope a place, once choped, other guys have
// to wait till it's available. chope is slang for reserved
package main
import (
"fmt"
"sync"
"time"
)
@wari
wari / go benchmark (counter mode) test results
Created February 20, 2014 08:22
My silly tests with Go and Nodejs with RaspberryPi RevB 512MB, all these due to the silly discussion in golang-nuts - https://groups.google.com/forum/#!topic/golang-nuts/zeLMYnjO_JA[1-25-false] TLDR: Even with extra work golang is faster :P
pi@waripi ~ $ ab -n 1000 -n 10000 http://192.168.1.244:8000/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 192.168.1.244 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
@wari
wari / hello.go
Last active January 3, 2016 07:59
// See this running @ http://play.golang.org/p/PN7GapMy3q
package main
import "fmt"
func main() {
你好 := "Hello"
world := "世界"
问好(你好, world)
@wari
wari / Rakefile
Last active December 14, 2015 02:08
Easy to use video services downloader Rakefile
# Easy to use downloader Rakefile
# Add as many URLs you want in a file called download
# Requires youtube-dl - http://rg3.github.com/youtube-dl/
#
# echo URL >> download
# rake hq
#
# If you use a different source file, then run as follows:
#
# rake SOURCEFILE=some_other_file.txt
@wari
wari / convert720p.rb
Created October 31, 2011 06:58 — forked from czj/gist:1263872
Script to encode with HandbrakeCLI (x264) 720p, high image quality, low file size
#!/usr/bin/env ruby
# encoding: utf-8
# x264 presets guide : https://forum.handbrake.fr/viewtopic.php?f=6&t=19426
X264 = "b-adapt=2:rc-lookahead=50:me=umh:bframes=5:ref=6:direct=auto:trellis=2:subq=10:psy-rd=1.0,0.10:analyse=all"
FORMAT = "--optimize --format mp4"
QUALITY = "--ab 64 --mixdown mono --quality 23 -e x264 -x '#{X264}'"
SIZE = "--width 1280 --height 720"
ARGV.each do |param|
~ % cat bdsmtest.sh
#!/usr/bin/env bdsm
modules array
my_array=(1 2 3 4)
echo ${my_array[@]}
array_shift my_array
echo ${my_array[@]}
~ % ./bdsmtest.sh
1 2 3 4