Skip to content

Instantly share code, notes, and snippets.

View jbub's full-sized avatar

Juraj Bubniak jbub

View GitHub Profile
@jbub
jbub / pip-list-redundant-pkgs.sh
Created June 12, 2013 08:18
pip list all packages that are installed but not present in the requirements.txt file
pip freeze | grep -v -f requirements.txt
@jbub
jbub / compressors.py
Created June 12, 2013 08:33
cssmin compressor for django-pipeline that is using the CompressorBase instead of SubProcessCompressor format
from pipeline.compressors import CompressorBase
class CSSMinCompressor(CompressorBase):
def compress_css(self, css):
from cssmin import cssmin
return cssmin(css)
@jbub
jbub / clean_pyc.sh
Created June 12, 2013 08:34
remove all .pyc files recursively
find . -name "*.pyc" -exec rm {} \;
@jbub
jbub / squash-commits.sh
Created June 12, 2013 15:31
git squash last two commits into one
git rebase --interactive HEAD~2
# we are going to squash c into b
pick b76d157 b
pick a931ac7 c
# squash c into b
pick b76d157 b
s a931ac7 c
@jbub
jbub / git-change-remote.sh
Created June 12, 2013 17:55
git change remote url
git remote set-url origin git://new.url.here
@jbub
jbub / osx-reset-dns-cache.sh
Created June 26, 2013 07:56
Reset the DNS cache on OS X Mountain Lion.
sudo killall -HUP mDNSResponder
@jbub
jbub / debian-delete-mail.sh
Created July 5, 2013 09:52
Delete mail messages in debian.
# run mail
mail
# delete single message by its id
d 6
# delete messages using range of ids, from 1 to 20
d 1-20
# you must quit properly in order to delete messages
@jbub
jbub / clean-macports.sh
Created July 8, 2013 21:23
Clean macports temporary build files and remove inactive ports.
# remove all temporary build files
sudo port clean --all installed
# remove all inactive ports
sudo port -f uninstall inactive
@jbub
jbub / fix-tinymce-popup.sh
Created July 10, 2013 08:34
If you are using tinymce across subdomains you need to uncomment and changedocument.domain in tiny_mce_popup.js.
# document.domain is commented by default, change it to our domain and uncomment it, this will edit file in place
sed -i "s/\/\/ document.domain = 'moxiecode.com';/document.domain = 'example.com';/" path/to/tiny_mce/tiny_mce_popup.js
# note that in order to get this working on os x, you must pass argument to -i
# this will save unedited copy of tiny_mce_popup.js as tiny_mce_popup.js.tmp
sed -i ".tmp" "s/\/\/ document.domain = 'moxiecode.com';/document.domain = 'example.com';/" path/to/tiny_mce/tiny_mce_popup.js
@jbub
jbub / pg_dump_restore.sh
Created August 9, 2013 08:50
postgres dump and restore data
# dump database dbname to dbname.dump
pg_dump -Fc --data-only --disable-triggers dbname > dbname.dump
# restore database dbname to dbname from dbname.dump
pg_restore -U username -h hostname.com --disable-triggers -d dbname dbname.dump