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
# ADD this to Rakefile and run it by issuing rake roles.to_json | |
ROLE_DIR = File.expand_path(File.join(TOPDIR, "roles")) | |
namespace :roles do | |
desc "Convert ruby roles from ruby to json, creating/overwriting json files." | |
task :to_json do | |
Dir.glob(File.join(ROLE_DIR, '*.rb')) do |rb_file| | |
role = Chef::Role.new | |
role.from_file(rb_file) | |
json_file = rb_file.sub(/\.rb$/,'.json') |
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
/** Class: Strophe.WebSocket | |
* XMPP Connection manager. | |
* | |
* Thie class is the main part of Strophe. It manages a BOSH connection | |
* to an XMPP server and dispatches events to the user callbacks as | |
* data arrives. It supports SASL PLAIN, SASL DIGEST-MD5, and legacy | |
* authentication. | |
* | |
* After creating a Strophe.Connection object, the user will typically | |
* call connect() with a user supplied callback to handle connection level |
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
# Split MYSQL dump file | |
zcat dump.sql.gz | awk '/DROP TABLE IF EXISTS/{n++}{print >"out" n ".sql" }' | |
# Parallel import using GNU Parallel http://www.gnu.org/software/parallel/ | |
ls -rS *.sql | parallel --joblog joblog.txt mysql -uXXX -pYYY db_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
# install git | |
sudo apt-get install g++ curl libssl-dev apache2-utils | |
sudo apt-get install git-core | |
# download the Node source, compile and install it | |
git clone https://github.com/joyent/node.git | |
cd node | |
./configure | |
make | |
sudo make install | |
# install the Node package manager for later use |
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 | |
function jsonval { | |
temp=`echo $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w $prop` | |
echo ${temp##*|} | |
} | |
json=`curl -s -X GET http://twitter.com/users/show/$1.json` | |
prop='profile_image_url' | |
picurl=`jsonval` |
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
#!/usr/bin/env ruby | |
# List all keys stored in memcache. | |
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place. | |
require 'net/telnet' | |
headings = %w(id expires bytes cache_key) | |
rows = [] |
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 'net/https' | |
http = Net::HTTP.new("example.com", 443) | |
http.use_ssl = true | |
http.verify_mode = OpenSSL::SSL::VERIFY_PEER | |
store = OpenSSL::X509::Store.new | |
store.set_default_paths | |
http.cert_store = store | |
# For Windows, use Net::HTTP#ca_file= instead of the above three lines as follows: | |
# http.ca_file = "/path/to/cacert.pem" | |
# Root certificates are available at http://curl.haxx.se/ca/cacert.pem |
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
#!/usr/bin/env ruby | |
require 'net/telnet' | |
require 'lib/trollop' | |
opts = Trollop::options do | |
banner <<-EOS | |
Command line tool to list memcache keys and to get the value of a specific key | |
Usage: | |
memcache [options] |
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
#XLarge DBInstanceClassMemory = 15892177440 = 14.8GB | |
#/32 = 496630545 = 473MB | |
#/64 = 248315272 = 236MB | |
#/128 = 124157636 = 118MB | |
#/256 = 62078818 = 59MB | |
#/512 = 31039409 = 29MB | |
#/12582880 = 1263 #default same divisor as max_connections = 4041.6MB = 4237924762 | |
#/25165760 = 623 # half of max_connections = 1993.6MB | |
#/50331520 = 315 # quarter of max_connections = 1008MB = 1056964608 | |
#*(3/4) #default innodb pool size = 11922309120 |
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
location xxxx { | |
proxy_pass http://localhost:9000; | |
proxy_buffering off; | |
proxy_cache off; | |
proxy_redirect off; | |
proxy_set_header Connection ''; | |
proxy_http_version 1.1; | |
chunked_transfer_encoding off; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; |
OlderNewer