Skip to content

Instantly share code, notes, and snippets.

View scalp42's full-sized avatar
👨‍🎨

Anthony Scalisi scalp42

👨‍🎨
View GitHub Profile
@scalp42
scalp42 / homebrew_mysql_pass_reset.txt
Created April 17, 2012 22:47 — forked from toritaba/homebrew_mysql_pass_reset.txt
Reset MySQL root password (Homebrew)
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
mkdir -p /usr/local/Cellar/mysql/`brew info mysql | head -n 1 | awk '{print $3}'`/data/
/usr/local/Cellar/mysql/`brew info mysql | head -n 1 | awk '{print $3}'`/bin/mysqld --basedir=/usr/local/Cellar/mysql/`brew info mysql | head -n 1 | awk '{print $3}'` --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/Cellar/mysql/`brew info mysql | head -n 1 | awk '{print $3}'`/lib/plugin --log-error=/usr/local/Cellar/mysql/`brew info mysql | head -n 1 | awk '{print $3}'`/data/errors.err --pid-file=/usr/local/Cellar/mysql/`brew info mysql | head -n 1 | awk '{print $3}'`/data/pidfile.pid --skip-grant-tables 2>&1 &
echo "UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root'; FLUSH PRIVILEGES;" > /tmp/resetroot.sql
mysql < /tmp/resetroot.sql
@scalp42
scalp42 / pre-commit
Created April 17, 2012 23:39 — forked from sdhull/pre-commit
.git/hooks/pre-commit
#!/usr/bin/env ruby
file_names = `git diff-index --cached -Sdebugger --name-only HEAD`
file_names += `git diff-index --cached -Ssave_and_open_page --name-only HEAD`
file_names = file_names.strip
if file_names != ""
puts "The following files have 'debugger' or 'save_and_open_page' statements in them: "
puts file_names
raise "Please remove this stuff prior to committing"
end
@scalp42
scalp42 / joyent-smartos.erb
Created April 24, 2012 02:27 — forked from benjaminws/joyent-smartos.erb
joyent-smartos.erb
# shove this in ~/.chef/bootstrap/joyent-smartos.erb
# run knife bootstrap <hostname> -d joyent-smartos
bash -c '
if [ ! -f /opt/local/bin/chef-client ]; then
cd /tmp
pkgin install gcc-compiler gcc-runtime gcc-tools-0 ruby19 scmgit-base scmgit-docs gmake sun-jdk6
wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.10.tgz
tar -xzf rubygems-1.8.10.tgz
cd rubygems-1.8.10
@scalp42
scalp42 / save_databags.sh
Created April 26, 2012 03:30 — forked from benjaminws/save_databags.sh
save databags to disk
#!/bin/bash
# Get all your data bags, save them to disk
set -e
KNIFE=/usr/bin/knife
SAVE_DIR=~/chef-repo/data_bags
for bag in `$KNIFE data bag list`; do
for item in `$KNIFE data bag show $bag`; do
@scalp42
scalp42 / save_roles.sh
Created April 26, 2012 03:30 — forked from benjaminws/save_roles.sh
Save roles
#!/bin/bash
# Get all your roles, save them to disk.
set -e
KNIFE=/usr/bin/knife
SAVE_DIR=~/chef-repo/roles
for role in `$KNIFE role list`; do
$KNIFE role show -F json $role > $SAVE_DIR/$role.json;
@scalp42
scalp42 / role_copy.rb
Created April 26, 2012 03:30 — forked from benjaminws/role_copy.rb
knife role copy
require 'chef/knife'
class Chef
class Knife
class RoleCopy < Knife
deps do
require 'chef/role'
require 'chef/json_compat'
end
@scalp42
scalp42 / joyent-smartos.erb
Created April 26, 2012 03:32 — forked from ulfmagnetics/joyent-smartos.erb
joyent-smartos.erb
# shove this in ~/.chef/bootstrap/joyent-smartos.erb
# run knife bootstrap <hostname> -d joyent-smartos
bash -c '
if [ ! -f /opt/local/bin/chef-client ]; then
cd /tmp
pkgin -y install gcc-compiler gcc-runtime gcc-tools-0 ruby19 scmgit-base scmgit-docs gmake
wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.10.tgz
tar -xzf rubygems-1.8.10.tgz
cd rubygems-1.8.10
@scalp42
scalp42 / gist:2495547
Created April 26, 2012 03:33 — forked from ulfmagnetics/gist:2040692
Chef on EC2
# -- assuming homebrew is up and running already
$ brew install ec2-api-tools
# -- get root X509 credentials from the AWS Security Credentials page
# -- place pk and cert pem files in $HOME/.ec2
# -- add the following into $HOME/.bash_profile:
# export REGION='us-west-1'
# export EC2_KEYPAIR="$HOME/.ssh/ec2-$REGION.pem"
@scalp42
scalp42 / pinger.rb
Created April 26, 2012 03:33 — forked from ulfmagnetics/pinger.rb
Simple site pinging script in ruby
URL = "http://www.lumosity.com"
MATCH_STRING = "Start Training"
INTERVAL = 30
DEBUG = false
def log(msg)
puts "[#{Time.now}] #{msg}"
end
def log_response(response)
@scalp42
scalp42 / gist:2589069
Created May 3, 2012 20:37 — forked from gerred/gist:667985
nginx.conf for reverse proxying
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;