Skip to content

Instantly share code, notes, and snippets.

@taboularasa
taboularasa / tables_to_CSV.md
Last active August 29, 2015 13:57
export all tables to CSV

In psql, define the function:

CREATE OR REPLACE FUNCTION db_to_csv(path TEXT) RETURNS void AS $$
declare
  tables RECORD;
  statement TEXT;
begin
  FOR tables IN
 SELECT (table_schema || '.' || table_name) AS schema_table
@taboularasa
taboularasa / .rubocop.yml
Last active August 29, 2015 13:55
Rubocop config
StringLiterals:
EnforcedStyle: double_quotes
LineLength:
Max: 80
# When using conditionals in assignment, the `end` should align with the
# beginning of the variable, not the `if`
EndAlignment:
AlignWith: variable
# hubot-scripts test
# usage:
# hubot cmd ls -la
#
fs = require('fs')
spawn = require('child_process').spawn
module.exports = (robot) ->
robot.respond /(cmd) (.*) (.*)/i, (msg) ->
cmd = msg.match[2]
arg = msg.match[3]
#!/usr/bin/env ruby
require 'csv'
# This assumes:
# - Ruby 1.9's CSV library, if you are using 1.8, use FasterCSV.
#
# https://raw.github.com/hadley/data-baby-names/master/baby-names.csv
csv_fname = "baby-names.csv"
require 'rubygems'
require 'google_drive'
# set your username and password
login = GoogleDrive.login(GoogleDrive::USERNAME, GoogleDrive::PASSWORD)
# set your spreadsheet key
sheet = login.spreadsheet_by_key(GoogleDrive::SPREADSHEET)
sheet.worksheets.each do |ws|
p ws.title
@taboularasa
taboularasa / a-linkdump.md
Last active December 13, 2015 17:39
some links i should read

This is a dump of links to checkout for later.

@taboularasa
taboularasa / gist:2946941
Created June 18, 2012 05:08
scrape parallel flickr backup for lightroom import
import re
import sys
import os
from stat import *
import subprocess
import shlex
import hashlib
import time
import datetime
import pymongo
@taboularasa
taboularasa / gist:2943538
Created June 17, 2012 05:46
Rotate a cellphone video with ffmpeg
$ffmpeg -i <input file> -threads <max threads> -vf "transpose=1" -s 1280x720 -r <frame rate> -sameq <output file>
@taboularasa
taboularasa / gist:2045181
Created March 15, 2012 16:38
ubuntu /var/www permissions
sudo usermod -a -G www-data <some_user>
sudo chgrp -R www-data /var/www
sudo chmod -R g+w /var/www
sudo find /var/www -type d -exec chmod 2775 {} \;
sudo find /var/www -type f -exec chmod ug+rw {} \;