Magic words:
psql -U postgres
Most \d
commands support additional param of __schema__.name__
and accept wildcards like *.*
\q
: Quit/Exit\c __database__
: Connect to a database\d __table__
: Show table definition including triggers
#!/bin/sh | |
# Remove stray debugger statements from the modified files before committing | |
# get a list of added, modified, copied files | |
files=`git diff --cached --name-only --diff-filter=ACM` | |
# remove debugger lines | |
# | |
# 1. remove any line containing a debugger |
#!/bin/sh | |
# Remove stray debugger statements from the modified files before committing | |
# get a list of added, modified, copied files | |
files=`git diff --cached --name-only --diff-filter=ACM` | |
# remove debugger lines | |
# | |
# 1. remove any line containing a debugger |
#!/usr/bin/env ruby | |
require "nokogiri" | |
require "open-uri" | |
def download(url, output_file) | |
exit unless system("wget -c #{url} --load-cookies=cookies.txt -O #{output_file}") | |
end | |
def download_pages |
#!/usr/local/bin/ruby | |
# A script to download the latest episodes from railscasts.com | |
# | |
# author: modsaid <mahmoud@modsaid.com> | |
# mechanize support: Hossam Hammady <github@hammady.net> | |
# gem install mechanize | |
require 'rubygems' | |
require 'mechanize' |
#!/usr/bin/ruby | |
require 'rss' | |
p 'Downloading rss index' | |
rss_string = open('http://feeds.feedburner.com/railscasts').read | |
rss = RSS::Parser.parse(rss_string, false) | |
videos_urls = rss.items.map { |it| it.enclosure.url }.reverse | |
videos_filenames = videos_urls.map {|url| url.split('/').last } |
require 'rss' | |
require 'open-uri' | |
p "Downloading rss index" | |
# If you are a Railscasts Pro subscriber, you will have a different RSS feed with Pro casts | |
# If this is the case, go to http://railscasts.com/, find it and sub it below | |
rss_string = open('http://feeds.feedburner.com/railscasts').read | |
rss = RSS::Parser.parse(rss_string, false) | |
videos_urls = rss.items.map { |it| it.enclosure.url }.reverse |
require "rubygems" | |
require "octokit" # gem install octokit | |
1.upto(5) do |page| | |
Octokit.repositories("railscasts", page: page, per_page: 100).each do |repo| | |
system "git clone git://github.com/railscasts/#{repo.name}" | |
end | |
end |
Magic words:
psql -U postgres
Most \d
commands support additional param of __schema__.name__
and accept wildcards like *.*
\q
: Quit/Exit\c __database__
: Connect to a database\d __table__
: Show table definition including triggers# Set variables in .bashrc file | |
# don't forget to change your path correctly! | |
export GOPATH=$HOME/golang | |
export GOROOT=/usr/local/opt/go/libexec | |
export PATH=$PATH:$GOPATH/bin | |
export PATH=$PATH:$GOROOT/bin |
module RandomPassword | |
def generate | |
# create a one big array of seeding data | |
seed = [('a'..'z'), ('!'..'+'), (1..9), ('A'..'Z')].map { |e| e.to_a }.flatten | |
# get random 16 characters from this array | |
original = (0..16).map { seed[rand(seed.length)] }.join | |
# just to be sure, randomize them once more | |
original.split('').shuffle.join | |
end | |
end |