Skip to content

Instantly share code, notes, and snippets.

View JonCrawford's full-sized avatar
🏗️
Helping startups on product, tech & data analytics

Jonathan Crawford JonCrawford

🏗️
Helping startups on product, tech & data analytics
View GitHub Profile
@JonCrawford
JonCrawford / gist:44415
Created January 7, 2009 20:45 — forked from anonymous/gist:44410
Improved! A slight alteratiion of DHH's dynamic subdomain technique.
# 1) Point *.example.com in your DNS setup to your server.
#
# 2) Setup an Apache vhost to catch the star pointer:
#
# <VirtualHost *:80>
# ServerName *.example.com
# </VirtualHost>
#
# 3) Set the current account from the subdomain
class ApplicationController < ActionController::Base
## Colors Git and shows branch
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function proml {
local BLUE="\[\033[0;34m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
class AddSecurityStringToOrder < ActiveRecord::Migration
def self.up
add_column :orders, :security_string, :string
end
def self.down
remove_column :orders, :security_string
end
end
> Product.best_sellers
'SELECT `products`.*, COUNT(*) AS total FROM `products` INNER JOIN order_items ON order_items.product_id = products.id INNER JOIN orders ON orders.id=order_items.order_id WHERE ((orders.payment_state=3) GROUP BY products.id ORDER BY total DESC'
# Yay!
> @store.products.best_sellers
'SELECT `products`.*, COUNT(*) AS total FROM `products` INNER JOIN order_items ON order_items.product_id = products.id INNER JOIN orders ON orders.id=order_items.order_id WHERE (`products`.store_id = 464) AND (orders.payment_state=3) GROUP BY products.id ORDER BY products.name ASC'
# Nooo!!!
s3_config = YAML.load_file(RAILS_ROOT + "/config/amazon_s3.yml")
s3_config = s3_config['staging'].to_options
@s3 = RightAws::S3.new(s3_config[:access_key_id], s3_config[:secret_access_key])
@s3_interface = RightAws::S3Interface.new(s3_config[:access_key_id], s3_config[:secret_access_key])
to_bucket = @s3.bucket(<bucket_name>)
to_bucket = @s3.bucket(<bucket_name>)
keys = from_bucket.keys('prefix' => 'background_images')
=== Epic Snow Leopard Upgrayyyyd Guide ===
Son, you’re now living in the land of 64-bit systems.
That means that some of your 32-bit shit is now broken.
Not all is lost.
== Fixing MySQL weirdness
# needed to get spork/rspec running under snow leopard
# edit line 12 of rspec-1.2.8/lib/spec/runner/drb_command_line.rb
# was
# DRb.start_service("druby://localhost:0")
# should be
DRb.start_service("druby://127.0.0.1:0")
<?php
//exploit search
$Lversion = php_uname(r);
$OSV = php_uname(s);
if(eregi('Linux',$OSV))
{
$Lversion=substr($Lversion,0,6);
$millink="http://milw0rm.com/search.php?dong=Linux Kernel ".$Lversion;
$stormlink="http://www2.packetstormsecurity.org/cgi-bin/search/search.cgi?searchvalue=Linux+Kernel+".$Lversion;