Skip to content

Instantly share code, notes, and snippets.

View jbub's full-sized avatar

Juraj Bubniak jbub

View GitHub Profile
@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': [],
@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 / 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.yaml
Created January 25, 2014 13:16
Install newest pip, setuptools, virtualenv with your python app dependencies.
download_pip:
cmd.run:
- name: "curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py"
- cwd: /tmp
- unless: "test -f /tmp/get-pip.py"
- require:
- pkg: curl
install_pip:
cmd.run:
@jbub
jbub / sublimetext.json
Last active January 2, 2016 09:59
Sublime Text 3 user settings.
{
"color_scheme": "Packages/User/Tomorrow-Night.tmTheme",
"draw_white_space": "selection",
"find_selected_text": true,
"font_face": "Ubuntu Mono",
"font_options":
[
"subpixel_antialias"
],
"font_size": 13.0,
@jbub
jbub / kill.sh
Last active April 3, 2017 11:16
Kill all salt-master processes.
ps aux | grep -ie salt-master | grep -v grep | awk '{print $2}' | xargs kill -9
@jbub
jbub / sqlalchemy.py
Created November 15, 2013 09:56
Sqlalchemy declarative example.
# coding=utf-8
from sqlalchemy import Column, String, Integer, create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, scoped_session
engine = create_engine('mysql://root@localhost/test')
Base = declarative_base()
@jbub
jbub / crontab.sh
Created October 30, 2013 15:30
Redirect program output to null output, cron will not send any email notification.
@reboot /path/to/program >/dev/null 2>&1
@jbub
jbub / go-sublime.json
Last active December 23, 2015 01:29
In order to get GoSublime working in Sublime Text 3 you need to provide GOPATH. The simplest way seems to be updating your GoSublime.sublime-settings.
{
"env": {
"GOPATH": "$HOME/Projekty/GO/dev/src",
}
}
@jbub
jbub / scp-copy.sh
Created September 11, 2013 13:57
Copy remote directory to local directory
# copy remote directory to local directory
scp -r -P 22 user@your.server.example.com:/path/to/foo /home/user/Desktop/