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
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 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 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 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 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" : { |
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
Some tests... | |
Number of unique paths from (0,0) to (0,0) on board of size 1x1 is 1 | |
Number of unique paths from (0,0) to (1,1) on board of size 2x2 is 2 | |
Number of unique paths from (0,0) to (2,2) on board of size 3x3 is 12 | |
Number of unique paths from (0,0) to (3,3) on board of size 4x4 is 184 | |
Number of unique paths from (0,0) to (4,4) on board of size 5x5 is 8512 |
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
http://virtual-machine.org/debian-6-amd64-x86_64-vmware-image-download |
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/bash | |
EC2_DIR=/usr/local/ec2 | |
wget http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip -O ec2-api-tools.zip | |
wget http://s3.amazonaws.com/ec2-downloads/ec2-ami-tools.zip -O ec2-ami-tools.zip | |
mkdir -p $EC2_DIR | |
rm -rf $EC2_DIR/* | |
unzip -o -d $EC2_DIR ec2-api-tools.zip | |
unzip -o -d $EC2_DIR ec2-ami-tools.zip | |
cp -r $EC2_DIR/ec2-api-tools*/* $EC2_DIR | |
cp -r $EC2_DIR/ec2-ami-tools*/* $EC2_DIR |
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
echo "sun-java6-jdk shared/accepted-sun-dlj-v1-1 boolean true" | debconf-set-selections | |
DEBIAN_FRONTEND=noninteractive aptitude install -y -f sun-java6-jre sun-java6-bin sun-java6-jdk |
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
sudo vim /etc/sysctl.conf | |
#Increase ephemeral port range | |
net.inet.ip.portrange.first=32768 | |
#Decrease closing timeout | |
net.inet.tcp.msl=1000 |