Skip to content

Instantly share code, notes, and snippets.

View adammeghji's full-sized avatar

Adam Meghji adammeghji

View GitHub Profile
@adammeghji
adammeghji / email_scrape.sh
Created May 20, 2011 19:35
Scrape your Mail.app inboxes in Mac OS X for email addresses
find ~/Library/Mail/. -print | xargs perl -wne'while(/[\w\.]+@[\w\.]+[.]\w+/g){print "$&\n"}' 2> /dev/null | sort -u
@adammeghji
adammeghji / hack.sh
Created April 2, 2012 23:23 — 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
#
@adammeghji
adammeghji / gist:5637522
Created May 23, 2013 16:48
Convert a PostgreSQL database from SQL_ASCII to UTF8 encoding
# convert createdb's template to UTF8
echo "UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';" | psql -U postgres
echo "drop database template1;" | psql -U postgres
echo "create database template1 with template = template0 encoding = 'UTF8';" | psql -U postgres
echo "update pg_database set datacl='{=c/postgres,postgres=CTc/postgres}' where datname='template1';" | psql -U postgres
echo "UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';" | psql -U postgres
# export and reimport as UTF8
pg_dump -U uniiverse --encoding utf8 mydatabase -f mydatabase_utf8.sql
createdb -U postgres -E utf8 mydatabase_utf8
@adammeghji
adammeghji / gist:6213016
Created August 12, 2013 17:20
Quick & dirty script to rsync an fswatch'ed directory on OSX and beep when updates are pushed
#!/bin/sh
CMD="rsync -avz --progress -L --exclude .git* --delete $HOME/Code/tools karate:Code/"
NOTIFY="afplay /System/Library/Sounds/Morse.aiff 1> /dev/null 2> /dev/null"
$HOME/Code/vendor/fswatch/fswatch $HOME/Code/. "$CMD; $NOTIFY"%
root@redirect:~# adduser
adduser: Only one or two names allowed.
root@redirect:~# sudo adduser ubunut
Adding user `ubunut' ...
Adding new group `ubunut' (1000) ...
Adding new user `ubunut' (1000) with group `ubunut' ...
Creating home directory `/home/ubunut' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:

Keybase proof

I hereby claim:

  • I am adammeghji on github.
  • I am adammeghji (https://keybase.io/adammeghji) on keybase.
  • I have a public key ASAgi6xc_knSRHh99Cl67SUHuw8lT_xU3e_cRO28S0m0zQo

To claim this, I am signing this object: