Skip to content

Instantly share code, notes, and snippets.

View wangyuchen's full-sized avatar

Yuchen Wang wangyuchen

View GitHub Profile
@wangyuchen
wangyuchen / pander_proposal_yuchen_wang.md
Last active August 29, 2015 13:57
GSoC 2014 proposal
@wangyuchen
wangyuchen / revise_time.R
Last active December 29, 2015 22:49
simple R
res$dist <- unlist(lapply(c("Log-normal", "Gamma", "Uniform", "t"), rep, times=8))
gl(n=4, k=8, labels=c("Log-normal", "Gamma", "Uniform", "t"))
(*
-- Send the selected files in Finder to Keka (for compression)
--
-- @author Scott Buchanan <buchanan.sc@gmail.com>
-- @link http://wafflesnatcha.github.com
*)
tell application "Finder"
set _files to selection as alias list
if _files is {} then return display alert "No files selected!" as warning giving up after 5
@wangyuchen
wangyuchen / gist:5593641
Created May 16, 2013 17:52
Mac apache configuration, create file at /etc/apache2/users/USERNAME.conf
<Directory "/Users/USERNAME/Sites/">
Options Indexes Multiviews
AllowOverride AuthConfig Limit
Order allow,deny
Allow from all
</Directory>
pb <- txtProgressBar(min = 0, max = kRep, style=3)
for (i in 1:kRep) {
setTxtProgressBar(pb, i)
}
# right way to collect data frame output of mclapply
do.call(rbind, mclapply(...))
# since do.call treat the second arg as a list, it will correctly passed it to rbind
# this way doesn't work
a <- mclappy(...)
rbind(a)
#!/bin/sh
# the provided script from goagent didn't work on mac
curl -O https://github.com/downloads/SiteSupport/gevent/gevent-1.0rc2.tar.gz
tar xvzpf gevent-1.0rc2.tar.gz
cd gevent-1.0rc2
sudo python setup.py install