Skip to content

Instantly share code, notes, and snippets.

View jbub's full-sized avatar

Juraj Bubniak jbub

View GitHub Profile
@jbub
jbub / pypi.sh
Created August 11, 2013 05:21
how to build your own python package and upload it to pypi
# build source distribution
python setup.py sdist
# build wheel distribution
python setup.py bdist_wheel
# register with pypi test server
python setup.py register -r test
# configure your .pypirc
@jbub
jbub / archives.sh
Last active May 25, 2017 13:43
example usage of zip and tar archiving tools
# crossplatform, poor compression, fast
zip -r archive_name.zip path/to/compress
# extract zip in current directory
unzip archive_name.zip
# compress with tar, poor compression, very fast
tar cvf archive_name.tar path/to/compress
@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
@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 / 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 / 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 / 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 / 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 / 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 / clean_pyc.sh
Created June 12, 2013 08:34
remove all .pyc files recursively
find . -name "*.pyc" -exec rm {} \;