This file contains hidden or 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
.Spotlight-*/ | |
.Trashes | |
/afs/* | |
/automount/* | |
/cores/* | |
/dev/* | |
/Network/* | |
/private/tmp/* | |
/private/var/run/* | |
/private/var/spool/postfix/* |
This file contains hidden or 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
var AMP = 0.5; // amplitude | |
var len = 15; // seconds | |
e = new webkitAudioContext(); | |
var source = e.createBufferSource(); | |
var SR = e.sampleRate; | |
source.buffer = e.createBuffer(1, len * SR, SR); | |
var dat = source.buffer.getChannelData(0); | |
for (var i = 0; i < len * SR; i++) { | |
dat[i] = AMP * (Math.random() * 2 - 1); | |
} |
This file contains hidden or 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
<dependency org="org.apache.zookeeper" name="zookeeper" rev="3.4.5"> | |
<exclude org="log4j" module="log4j"/> | |
<exclude org="org.slf4j" module="slf4j-log4j12"/> | |
<exclude org="jline" module="jline"/> | |
</dependency> |
This file contains hidden or 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 scala.util.Random | |
import java.security.SecureRandom | |
import java.util.concurrent.atomic.AtomicLong | |
import org.joda.time.DateTimeUtils | |
/** | |
* 64 bit unique id generator | |
* Features: | |
* 1. generate ascending or descending ids | |
* 2. 64 bit id consists of: |
This file contains hidden or 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
// Excercies from chapter 5: Strictness and laziness | |
def foldRight[A,B](z: => B)(s: Stream[A])(f: (A, => B) => B): B = | |
s match { | |
case hd #:: tail => f(hd, foldRight(z)(tail)(f)) | |
case _ => z | |
} | |
def exists[A](s: Stream[A])(p: A => Boolean): Boolean = | |
foldRight(false)(s)((x,a) => if (p(x)) true else a) |
This file contains hidden or 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
DB=my_db | |
mysqldump -uroot -h localhost $DB --opt --compress | gzip -9 -c > $DB-backup-`date +%Y%m%d%H`.sql.tgz | |
gunzip -c $DB-backup-`date +%Y%m%d%H`.sql.tgz > a.sql | |
mysql -u root $DB < a.sql |
This file contains hidden or 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
require 'aws/s3' | |
require 'RMagick' | |
include AWS::S3 | |
include Magick | |
AWS::S3::Base.establish_connection!( | |
:access_key_id => 'key', | |
:secret_access_key => 'secret' | |
) | |
bucket = 'bucket_name'; |
This file contains hidden or 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
If you have noticed, Mac OS X doesn’t support writing onto NTFS disks. But not to worry, you don’t have to install any third party drivers to enable this. Mountain Lion 10.8.3 already has native write support for the NTFS. OSX Mountain Lion does have built-in support for NTFS, and it can read and write. However, Apple does not enable it by default. | |
Here is what you should do: | |
Uninstall other 3rd-party NTFS software, like Paragon, Tuxera or NTFS-3G. | |
Edit /etc/fstab (you can do this with “sudo vi /etc/fstab”) | |
Add the following line: | |
LABEL=”VOLUME_NAME_WITHOUT_QUOTES” none ntfs rw,auto,nobrowse | |
Quit your editor | |
Now, just unmount and re-mount the disk |
This file contains hidden or 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
apt-get update | |
apt-get install vim git | |
apt-get install libcurl4-openssl-dev | |
apt-get install apache2-prefork-dev | |
apt-get install libapr1-dev | |
apt-get install libaprutil1-dev | |
bash -s master < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) | |
echo '[[ -s "/usr/local/rvm/scripts/rvm" ]] && . "/usr/local/rvm/scripts/rvm"' >> ~/.bashrc | |
echo 'PATH=$PATH:/usr/local/rvm/bin' >> ~/.bashrc |
This file contains hidden or 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
curl -XDELETE 'http://localhost:9200/test/' | |
curl -XPUT 'http://localhost:9200/test/' -d '{ | |
"settings" : { | |
"number_of_shards" : 1, | |
"number_of_replicas" : 1 | |
}, | |
"mappings" : { | |
"profile" : { | |
"properties" : { |