Skip to content

Instantly share code, notes, and snippets.

View dangerousbeans's full-sized avatar

Joran Kikke dangerousbeans

  • New Zealand
View GitHub Profile
[user]
name = Joran Kikke
email = joran.k@gmail.com
[github]
user = dangerousbeans
[core]
autocrlf = input
safecrlf = true
@dangerousbeans
dangerousbeans / gist:1173032
Created August 26, 2011 09:16
Example of non-read only association find
itinerary.lodgings.readonly(false).find(params[:id])
@dangerousbeans
dangerousbeans / gist:1200155
Created September 7, 2011 09:33
Remove deleted files from git
git ls-files --deleted | xargs git rm
@dangerousbeans
dangerousbeans / .bash_aliases
Created September 9, 2011 10:40
.bash_aliases config for rails development
# clear and rebuild a rails app database (with bulk load rake task)
alias brails='rake db:drop && rake db:create:all && rake db:migrate && rake db:seed:load && rake db:seed'
@dangerousbeans
dangerousbeans / edgecase_verbal_blacklist.txt
Created September 9, 2011 10:50
Things not to mention aloud at Edgecase UK
1 - "Is this the Aladdin Soundtrack?"
2 - "Should we go and eat Mexican over lunch? I heard it was really close by."
3 - "Trams"
(related)
3.1 - "Edinburgh Apple Store"
@dangerousbeans
dangerousbeans / pgsql_backup.sh
Created September 30, 2011 08:40
Database backup script (pgsql)
FILE=`date +"%Y%m%d"`_backup.sql
DBSERVER=127.0.0.1
DATABASE=
USER=postgres
PASS=
# (2) in case you run this twice in one day, remove the previous version of the file
unalias rm 2> /dev/null
rm ${FILE} 2> /dev/null
rm ${FILE}.gz 2> /dev/null
@dangerousbeans
dangerousbeans / remote_rebuild.sh
Created October 4, 2011 10:55
Database recreate from remote script
dropdb -h localhost metadata_staging -U postgres && createdb -h localhost -U postgres metadata_staging && pg_dump -h test.dpluse.net metadata_staging && psql metadata_staging postgres < metadata_staging.sql
-- What roles have access to which attributes on the given entity
SELECT r.name, a.name
FROM meta_attribute_roles ar
JOIN roles r on ar.role_id = r.id
JOIN meta_attributes a ON ar.meta_attribute_id = a.id
JOIN meta_entities e ON a.meta_entity_id = e.id
WHERE e.name like '%festival%';
@dangerousbeans
dangerousbeans / .bash_profile
Created October 16, 2011 09:56
OSX .bash_profile
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
# MacPorts Installer addition on 2011-05-12_at_15:42:16: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
export PGDATA=/usr/local/pgsql/data
export PATH=${PATH}:/usr/local/pgsql/bin
@dangerousbeans
dangerousbeans / compromised_system_diagnostics.sh
Created October 18, 2011 14:56
Anti-Hacker commands of usefullness and glory
# Find any files modified recently (4 days ago)
find / -type f -mtime -4 -exec ls -al {} \;
# Show detailed information about wtf a process is doing, 1234 = PID
lsof -p 1234