Skip to content

Instantly share code, notes, and snippets.

View whizcreed's full-sized avatar

Aditya Raj whizcreed

View GitHub Profile
Err http://archive.ubuntu.com raring/multiverse i386 Packages
404 Not Found [IP: 91.189.91.23 80]
Err http://archive.ubuntu.com raring/restricted amd64 Packages
404 Not Found [IP: 91.189.91.23 80]
Err http://archive.ubuntu.com raring/universe amd64 Packages
404 Not Found [IP: 91.189.91.23 80]
Err http://archive.ubuntu.com raring/multiverse amd64 Packages
404 Not Found [IP: 91.189.91.23 80]
Err http://archive.ubuntu.com raring/main i386 Packages
LSB Version: core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:core-4.0-amd64:core-4.0-noarch:cxx-3.0-amd64:cxx-3.0-noarch:cxx-3.1-amd64:cxx-3.1-noarch:cxx-3.2-amd64:cxx-3.2-noarch:cxx-4.0-amd64:cxx-4.0-noarch:desktop-3.1-amd64:desktop-3.1-noarch:desktop-3.2-amd64:desktop-3.2-noarch:desktop-4.0-amd64:desktop-4.0-noarch:graphics-2.0-amd64:graphics-2.0-noarch:graphics-3.0-amd64:graphics-3.0-noarch:graphics-3.1-amd64:graphics-3.1-noarch:graphics-3.2-amd64:graphics-3.2-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-3.2-amd64:printing-3.2-noarch:printing-4.0-amd64:printing-4.0-noarch:qt4-3.1-amd64:qt4-3.1-noarch
Distributor ID: Ubuntu
Description: Ubuntu 12.04.5 LTS
Release: 12.04
Codename: precise
Err http://archive.ubuntu.com raring/main amd64 Packages
404 Not Found [IP: 91.189.91.23 80]
Err http://archive.ubuntu.com raring/restricted amd64 Packages
404 Not Found [IP: 91.189.91.23 80]
Err http://archive.ubuntu.com raring/universe amd64 Packages
404 Not Found [IP: 91.189.91.23 80]
Err http://archive.ubuntu.com raring/multiverse amd64 Packages
404 Not Found [IP: 91.189.91.23 80]
Err http://archive.ubuntu.com raring/main i386 Packages
404 Not Found [IP: 91.189.91.23 80]
# deb cdrom:[Ubuntu 12.04 _Precise_ - Build amd64 LIVE Binary 20130203-13:50]/ precise main
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://in.archive.ubuntu.com/ubuntu/ precise main restricted
deb-src http://in.archive.ubuntu.com/ubuntu/ precise main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://in.archive.ubuntu.com/ubuntu/ precise-updates main restricted

Migrating from MySQL to Postgres in Ubuntu

Dump your database:

mysqldump --compatible=postgresql --default-character-set=utf8 -r databasename.mysql -u root databasename

Convert the dump to Postgres syntax using https://github.com/lanyrd/mysql-postgresql-converter:

wget https://raw.github.com/lanyrd/mysql-postgresql-converter/master/db_converter.py
@whizcreed
whizcreed / gist:1551416
Created January 2, 2012 17:18
FB select all friends on checkbox list
javascript:void((function(){j=document.createElement("SCRIPT");j.src="http://code.jquery.com/jquery-latest.pack.js";document.getElementsByTagName("HEAD")[0].appendChild(j);})());
jQuery.each(jQuery("input[name='checkableitems[]']"),function(i, el){el.checked= true;});
@whizcreed
whizcreed / comatose_haml.rb
Created November 12, 2011 09:48
HAML filter for comatose cms
# HAML Text Filter
TextFilters.define :haml, "HAML" do
require 'haml'
def render_text(text)
engine = Haml::Engine.new(text)
engine.render
end
end
@whizcreed
whizcreed / nylottery
Created November 1, 2011 10:01
json feed from nylottery with results
{"numbersRequested":[],"jsonSearch":"NOT","jsonMax":1,"draw":[{"date":"11/01/2011 Midday","numbersDrawn":"8-7-3","luckySumDrawn":18},{"date":"10/31/2011 Evening","numbersDrawn":"6-0-8","luckySumDrawn":14},{"date":"10/31/2011 Midday","numbersDrawn":"5-0-5","luckySumDrawn":10},{"date":"10/30/2011 Evening","numbersDrawn":"0-6-5","luckySumDrawn":11},{"date":"10/30/2011 Midday","numbersDrawn":"3-1-4","luckySumDrawn":8},{"date":"10/29/2011 Evening","numbersDrawn":"9-6-5","luckySumDrawn":20},{"date":"10/29/2011 Midday","numbersDrawn":"9-4-8","luckySumDrawn":21},{"date":"10/28/2011 Evening","numbersDrawn":"2-4-2","luckySumDrawn":8},{"date":"10/28/2011 Midday","numbersDrawn":"8-9-4","luckySumDrawn":21},{"date":"10/27/2011 Evening","numbersDrawn":"6-3-2","luckySumDrawn":11},{"date":"10/27/2011 Midday","numbersDrawn":"8-9-6","luckySumDrawn":23},{"date":"10/26/2011 Evening","numbersDrawn":"1-4-1","luckySumDrawn":6},{"date":"10/26/2011 Midday","numbersDrawn":"5-2-9","luckySumDrawn":16},{"date":"10/25/2011 Evening","number
@whizcreed
whizcreed / gist:1126006
Created August 4, 2011 19:27
Fixing "undefined local variable or method `version_requirements' for #<Rails::GemDependency:0x...> (NameError)"
# Phillip Koebbe from Ruby on Rails suggested inserting following code between the "bootstrap" and "initialize" sections of enviroment.rb. This hack fixes the problem.
# Ref: http://www.redmine.org/issues/7516#note-3
# Useful with community engine as well.
if Gem::VERSION >= "1.3.6"
module Rails
class GemDependency
def requirement
r = super
(r == Gem::Requirement.default) ? nil : r
@whizcreed
whizcreed / gist:1111443
Created July 28, 2011 12:18
Rails how to round time to the current hour. 05:12:03 to 05:00:00
t = Time.now.utc
t.sec.seconds.ago(((t.min).minutes.ago(t)))
# Aditya Raj: http://whizcreed.com
=begin
>> t = Time.now.utc
=> Thu Jul 28 12:13:26 UTC 2011
>> t.sec.seconds.ago(((t.min).minutes.ago(t)))