Skip to content

Instantly share code, notes, and snippets.

@bhattisatish
bhattisatish / ff.xsl
Created January 6, 2010 18:49 — forked from lindenb/ff.xsl
<?xml version='1.0' encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
<!--
Author:
Pierre Lindenbaum
http://plindenbaum.blogspot.com
Usage :
#!/usr/bin/ruby
require "rubygems"
require "mongo"
require "json/pure"
require "open-uri"
# db config
db = Mongo::Connection.new.db('friendfeed')
col = db.collection('lifesci')
#!/usr/bin/env ruby
puts "looking for the gems to upgrade..."
gem_info = Struct.new(:name, :version)
to_reinstall = []
Dir.glob('/Library/Ruby/Gems/**/*.bundle').map do |path|
path =~ /.*1.8\/gems\/(.*)-(.*?)\/.*/
name, version = $1, $2
bundle_info = `file path`
to_reinstall << gem_info.new(name, version) unless bundle_info =~ /bundle x86_64/
end
import pickle, pprint, time, os
import httplib
import smtplib
def emailAlert(alert,subject='You have an alert'):
fromaddr = "youremail@domain.com"
toaddrs = "youremail@domain.com"
# Add the From: and To: headers at the start!
<!DOCTYPE html>
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
<title>Browser Not Supported</title>
<meta content='text/html;charset=UTF-8' http-equiv='Content-Type'>
<style type='text/css'>
body {
color:#fff;
background:#00f;
text-align:center;
font-family: 'Courier New', Courier, monospace;
@bhattisatish
bhattisatish / gist:1199782
Created September 7, 2011 04:36 — forked from cchandler/gist:939951
glpk model for cloud vs colo costs
#Colo Server costs
set ServerTypes;
set InstanceTypes;
param CoreDemand; #How many cores do we need for a workload
param OurMoney; #The maximum upper-bound of what we're willing to spend
param ColoCostPerU; #How much are we paying per U of colocation
param Months; # How many months do we know we need this hardware
@bhattisatish
bhattisatish / yoursite_extension.rb
Created January 15, 2012 00:59 — forked from teeparham/yoursite_extension.rb
Adding new fields to Spree Variant's additional_fields
# Samples for formatting additional Product fields in Spree Admin
# SelectField: adds a select box with values 1..20
# WideField: adds a standard text box, but with a specified size
# HugeField: adds a text area with a specified number of columns
# OptionField: adds an option field
# CheckField: adds a checkbox field.
Variant.additional_fields += [
{ :name => 'SelectField',
:only => [:product],
@bhattisatish
bhattisatish / track_spree
Created January 18, 2012 07:05
TRACKS CHANGES TO PARTS OF SPREE SINCE A GIVEN COMMIT
#!/usr/bin/env zsh
# 1304046900 TRACKS CHANGES TO PARTS OF SPREE SINCE A GIVEN COMMIT
# To be placed at the root of your app.
old_commit="29e3d4f707bdb047a6fabc2543247139027b06fb"
parts=(
core/app/views
@bhattisatish
bhattisatish / gist:1885304
Created February 22, 2012 14:15 — forked from m0tive/gist:1884821
export google history
require 'mechanize'
require 'logger'
require 'date'
## Call:
## $ ruby export.rb <gmail> <password>
# https://www.google.com/history/lookup?hl=en&month=11&day=04&yr=2008&output=rss&num=9999
agent = Mechanize.new do |a|
@bhattisatish
bhattisatish / hack.sh
Created March 31, 2012 12:18 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#