Skip to content

Instantly share code, notes, and snippets.

{
"name" : "Ike's Place",
"address" : "3489 16th Street",
"city" : "San Francisco",
"state" : "California",
"phone" : "(415) 553‑6888"
"website" : "http://www.ikes.com",
"owner_email" : "ike@ilikeikesplace.com",
"owner_name" : "Ike Shehadeh",
"socials" : {
@tamoyal
tamoyal / gist:10303138
Last active August 29, 2015 13:58
Update Postgres 9.1 to 9.3 on Ubuntu
# Note this uses a dump and restore method. You can try using pg_upgrade instead
# Make a copy of postgresql.conf and hba.conf since you'll want to use those to edit the 9.3 conf later
$ sudo cp /etc/postgresql/9.1/main/postgresql.conf ~
$ sudo cp /etc/postgresql/9.1/main/pg_hba.conf ~
$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
$ sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" >> /etc/apt/sources.list.d/postgresql.list'
$ sudo apt-get update
$ sudo apt-get upgrade
@tamoyal
tamoyal / gist:33df0699327e503d3cf9
Created October 19, 2014 23:00
Some Resque helpers
# There are Minitest tests for reliably_enqueue below the module
# Note that this isn't well tested because it was used briefly for maintenance and we ended up killing Resque
# I apologize in advance for any off-by-one errors
module Resque
SLEEP_BETWEEN_RETRY = 0.1.freeze
RETRY = 3
NUM_PROCS_FOR_FAST_ENQUEUE = 10
class << self
@tamoyal
tamoyal / sync_me
Created September 30, 2015 00:46
Script to sync a local directory to external hard drive
#!/usr/bin/env bash
# This will sync LOCAL_DIR directory to XTAL_DIR (which is my xtal hard drive)
# It's meant to run on frequent polling cron job so that it syncs "immediately"
# when the xtal is plugged in. It will do nothing if the xtal drive is not
# plugged in.
# After a successful sync, it will change the crontab so it is not sync'd again
# for 24 hours. This script assumes you don't need more frequent backing up than
# that because I use it for my projects directory where everything important is
~/HumanGeo/datacards/crawlers/deps/hacked-bossmashup [master] $ sudo python setup.py install
running install
running build
running build_py
copying yos/crawl/dict2xml.py -> build/lib/yos/crawl
copying yos/crawl/object_dict.py -> build/lib/yos/crawl
copying yos/crawl/xml2dict.py -> build/lib/yos/crawl
running install_lib
copying build/lib/yos/crawl/dict2xml.py -> /usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/yos/crawl
copying build/lib/yos/crawl/object_dict.py -> /usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/yos/crawl
@tamoyal
tamoyal / gist:38287887923cc29869e5
Created December 29, 2014 20:02
Upgrade Postgres 9.3 to 9.4 on OS X
# Shutdown postgres
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
# Install 9.4
brew update && brew upgrade postgresql
# Make 9.4 DB
initdb /usr/local/var/postgres9.4 -E utf8
# Upgrade postgis or the upgrade will fail (if you require postgis)
@tamoyal
tamoyal / gist:2ea1fcdf99c819b4e07d
Last active February 13, 2020 11:24
Upgrade Postgres 9.3 to 9.4 on Ubuntu
# Be sure to save your config files. Optional but I do:
sudo cp /etc/postgresql/9.3/main/postgresql.conf ~
sudo cp /etc/postgresql/9.3/main/pg_hba.conf ~
# Package repo (for apt-get)
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" >> /etc/apt/sources.list.d/postgresql.list'
# Also probably optional but I like to update sources and upgrade
sudo apt-get update
@tamoyal
tamoyal / main.dart
Created May 30, 2020 22:07
Audio chat bubble
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@tamoyal
tamoyal / main.dart
Created May 30, 2020 22:17
Audio Chat Bubble with Clip (not working)
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@tamoyal
tamoyal / gist:a2fd3d76f6327d8e963f5136291c073d
Created September 17, 2021 23:52
For batch converting aif to mp3 and keeping original filename
for f in *.aif;
do
ffmpeg -i "$f" -f mp3 -acodec libmp3lame -ab 192000 -ar 44100 "${f%.aif}".mp3;
done