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
# Assuming you have homebrew installed on mac | |
export G=gource;D=./test-me.log;($G --output-custom-log - --path $D | grep -v '|D|') | ($G --path - --log-format custom --max-files 0 --file-idle-time 0 --time-scale 4 --seconds-per-day 0.00001 --max-file-lag 1 --auto-skip-seconds 0.000000000001 --bloom-intensity 1 --bloom-multiplier 1 --hide dirnames,filenames,users --elasticity 0.4 --stop-at-end --transparent) |
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 bash | |
# This script prints out all of your Redis keys and their size in a human readable format | |
# Copyright 2013 Brent O'Connor | |
# License: http://www.apache.org/licenses/LICENSE-2.0 | |
human_size() { | |
awk -v sum="$1" ' BEGIN {hum[1024^3]="Gb"; hum[1024^2]="Mb"; hum[1024]="Kb"; for (x=1024^3; x>=1024; x/=1024) { if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x]; break; } } if (sum<1024) print "1kb"; } ' | |
} |
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 bash | |
# This script prints out all of your Redis keys and their size in a human readable format | |
# Copyright 2013 Brent O'Connor | |
# License: http://www.apache.org/licenses/LICENSE-2.0 | |
human_size() { | |
awk -v sum="$1" ' BEGIN {hum[1024^3]="Gb"; hum[1024^2]="Mb"; hum[1024]="Kb"; for (x=1024^3; x>=1024; x/=1024) { if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x]; break; } } if (sum<1024) print "1kb"; } ' | |
} |
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 MyError < StandardError | |
attr_accessor :name | |
def initialize(name) | |
@name = name | |
end | |
end | |
def test(value) | |
trial = 0 |
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
Using jquery-rails (2.2.1) | |
Using launchy (2.1.2) | |
Installing libv8 (3.16.14.3) | |
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. | |
/usr/local/bin/ruby extconf.rb | |
creating Makefile | |
Compiling v8 for x64 | |
Using python 2.6.0 | |
Unable to find a compiler officially supported by v8. |
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
Starting MySQL... ERROR! The server quit without updating PID file (/var/lib/mysql/servername.pid) | |
OR | |
Starting MySQL.The server quit without updating PID file (/[FAILED]mysql/servername.pid). | |
sestatus | |
echo 0 > /selinux/enforce | |
sestatus |
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 'csv' | |
class Exporter | |
DEFAULT_EXPORT_TABLES = [ Invoice, InvoiceItem, Item, Merchant, Transaction, User ] | |
DESTINATION_FOLDER = "tmp/" | |
def self.export_tables_to_csv(tables = DEFAULT_EXPORT_TABLES) | |
tables.each { |klass| export_table_to_csv(klass) } | |
end |
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
# 1. Install jenkins | |
sudo zypper addrepo http://pkg.jenkins-ci.org/opensuse/ jenkins | |
sudo zypper install jenkins | |
# You would be asked something like this: | |
# Do you want to reject the key, trust temporarily, or trust always? [r/t/a/?] (r): t | |
# Overall download size: 115.9 MiB. After the operation, additional 159.9 MiB will be used. | |
# Continue? [y/n/?] (y): y | |
# 2. Start jenkins | |
sudo /etc/init.d/jenkins start |
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
gem install passenger | |
passenger-install-nginx-module | |
sudo -E /usr/local/bin/ruby /usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.19/bin/passenger-install-nginx-module | |
vi /opt/nginx/conf/nginx.conf | |
# Add in http block: | |
# passenger_root /usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.19; | |
# passenger_ruby /usr/local/bin/ruby; | |
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 it is Rails-3 then using attar_accessible in model: | |
def self.needs_attr_accessible? | |
Rails::VERSION::MAJOR == 3 | |
end | |
if needs_attr_accessible? | |
attr_accessible :list_of_attributes | |
end |