Skip to content

Instantly share code, notes, and snippets.

View burnash's full-sized avatar
💭
I may be slow to respond.

Anton Burnashev burnash

💭
I may be slow to respond.
View GitHub Profile
@burnash
burnash / branch-to-repo.sh
Last active May 15, 2016 18:12
Move a Git branch out into its own repository
mkdir repo-name.git
cd repo-name.git
git --bare init
cd /path/to/existing/repo
git push /path/to/repo-name.git branch-to-move:master
# Add remote
cd /path/to/repo-name.git
git remote add origin https://github.com/username/repo-name.git
@burnash
burnash / imagemagick-install-steps
Last active March 27, 2019 12:00 — forked from rodleviton/imagemagick-install-steps
Installing Image Magick on Ubuntu 14.04
sudo -i
cd
apt-get install build-essential checkinstall -y
apt-get build-dep imagemagick -y
apt-get install libwebp-dev -y
wget http://www.imagemagick.org/download/ImageMagick-6.9.5-8.tar.gz
tar xzvf ImageMagick-6.9.5-8.tar.gz
cd ImageMagick-6.9.5-8/
./configure
make
#!/bin/bash
usage ()
{
cat <<UsageHERE
boot2docker-fwd -- Helper function to quickly manage port forwards between the boot2docker-vm and the host
Usage: boot2docker-fwd [ -n RULE_NAME ] [ -h HOST_PORT ] [ -p {tcp|udp} ] [ -i HOST_IP ] GUEST_PORT
or boot2docker-fwd -d RULE_NAME
or boot2docker-fwd -l
or boot2docker-fwd -A
@burnash
burnash / local_settings.py
Created April 1, 2015 20:17
How to extend Django settings variables with local_settings.py
# Code from Mikko Hellsing:
# http://www.robgolding.com/blog/2010/05/03/extending-settings-variables-with-local_settings-py-in-django/#comment-51863642
def get_setting(setting):
import settings
return getattr(settings, setting)
INSTALLED_APPS = get_setting('INSTALLED_APPS') + ('debug_toolbar', )
MIDDLEWARE_CLASSES = get_setting('MIDDLEWARE_CLASSES') + ('debug_toolbar.middleware.DebugToolbarMiddleware',)
INTERNAL_IPS = ('127.0.0.1',)
@burnash
burnash / gist:c51ad1ea254a8d1a11ad
Created March 3, 2015 00:58
Installing py2cairo on Ubuntu 14.10 in virtualenv
sudo apt-get install libtool automake
git clone --depth 1 git://git.cairographics.org/git/py2cairo
cd py2cairo
./autogen.sh --prefix=/path/to/virtual/env
make
make install
@burnash
burnash / django_model_graph.sh
Last active August 28, 2020 18:00 — forked from perrygeo/django_model_graph.sh
Generate Django Model Graph
apt-get install python-pygraphviz
pip install django-extensions
# add 'django_extensions' to INSTALLED_APPS in settings.py
python manage.py graph_models -a -o myapp_models.png
@burnash
burnash / gist:1f0615516ccdf826833c
Created February 27, 2015 15:38
Installing py2cairo on OS X 10.8.5 in virtualenv
# I ran into a problem when I was trying to import cairo installed into virtualenv
#
# >>> import cairo
# Fatal Python error: PyThreadState_Get: no current thread
# Abort trap: 6
# After extensive search I found possible source of the problem. When installing py2cairo from source code waf
# builder links .so file to a wrong version of Python:
# $ otool -L ./build_directory/src/_cairo.so
# ./build_directory/src/_cairo.so:
@burnash
burnash / gist:bf88f4c12fbf22707256
Created February 25, 2015 18:29
Installing matplotlib with virtualenv on OS X 10.8
brew install freetype
brew install pkg-config
PKG_CONFIG_PATH=/usr/local/bin/pkg-config pip install matplotlib
@burnash
burnash / gist:d6d35fbabd2566f2b1b9
Last active May 23, 2023 22:47
Find strings with non-latin characters in files
import sys
import os
import codecs
import unicodedata as ud
# from http://stackoverflow.com/questions/3094498/how-can-i-check-if-a-python-unicode-string-contains-non-western-letters
latin_letters = {}