Skip to content

Instantly share code, notes, and snippets.

View jbub's full-sized avatar

Juraj Bubniak jbub

View GitHub Profile
@jbub
jbub / email_export.sql
Created February 17, 2014 14:50
Export order emails as comma separated values.
SELECT string_agg(DISTINCT email, ',') FROM orders_order WHERE date_add >= '2013-12-20'
@jbub
jbub / pip-osx109-fix.sh
Created April 7, 2014 18:43
Fix for OS X 10.9 to ignore unused arguments errors in compilers to be able to install python packages using pip.
# compilers flags
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
export ARCHFLAGS=-Wunused-command-line-argument-hard-error-in-future
# passing -E options to respect environment variables
sudo -E pip install -U lxml numpy
@jbub
jbub / packages.py
Created May 6, 2014 10:57
Returns a list of all packages, each package has info about which package requires it and also its requirements.
import json
import pkg_resources
packages = {}
for pkg in pkg_resources.working_set:
packages[pkg.key.lower()] = {
'requires': [req.project_name.lower() for req in pkg.requires()],
'required_by': [],

Keybase proof

I hereby claim:

  • I am jbub on github.
  • I am jbub (https://keybase.io/jbub) on keybase.
  • I have a public key whose fingerprint is FCCB FA86 B25F 15C7 7EA7 BC7A E3ED AE55 0054 640D

To claim this, I am signing this object:

@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 / 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 / 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