Skip to content

Instantly share code, notes, and snippets.

View simion's full-sized avatar

Simion simion

  • DontPayFull
  • Bucharest, Romania
View GitHub Profile
@simion
simion / apache.vhost.conf
Created December 28, 2016 07:30
Enable leverage browser caching in apache virtualhost
<VirtualHost>
# ....
<IfModule mod_expires.c>
<FilesMatch "\.(css|ico|pdf|flv|jpg|jpeg|png|gif|js|swf)$">
ExpiresActive on
ExpiresDefault "access plus 1 year"
</FilesMatch>
</IfModule>
@simion
simion / sublime anaconda preferences.json
Created October 25, 2016 10:07
Some sublime text 3 preferences (for python full stack development)
{
"validate_imports": true,
"pep8_max_line_length": 120,
"anaconda_linter_mark_style": "none",
"anaconda_gutter_theme": "retina",
}
@simion
simion / step_1.sh
Last active October 20, 2016 08:39
Reset Django migrations (delete everything and create initial migrations)
#!/bin/sh
# this step is made only once by a single developer
# changes made by this script must be committed and pushed
if [[ `git status --porcelain` ]]; then
# working copy is not clean
echo "please commit or stash your changes"
exit
fi
@simion
simion / base_command.py
Created October 18, 2016 14:52
Django management command - multiprocessing helper
import multiprocessing
from django.core.management import BaseCommand
def multiprocess_func(view_func):
""" Decoratior which closes database connection before running wrapped function.
Also unpacks args for multiprocessing module. """
def _decorator(args):
connection.close()
@simion
simion / pypi_to_anaconda.sh
Last active October 3, 2016 11:57
Auto build/upload a package from pypi to anaconda cloud. The builds are for all platforms (osx/win/linux) and both major python versions (python 2.7 and 3.5)
#! /bin/sh
#
# Usage: bash pypi_to_anaconda.sh <pypi_package> <user_or_organisation>
# Eg: bash pypi_to_anaconda.sh cchardet simion
#
NAME=$1
ORG=$2
rm -rf ./$NAME
conda skeleton pypi $NAME
@simion
simion / post-merge
Last active August 29, 2015 14:13
Git hook that watches for a specific file being changed (when merging). It gives a red warning when changes are detected.
#!/bin/bash
set -eu
# place the content of this file in .git/hooks/post-merge and make it executable
# change the following variable acording to your needs.
# You can set either a file path, or a folder path (in this case, all files in that folder are being watched)
watch_path=pydpf/settings
@simion
simion / gist:e1b21f31997cec1b39af
Created November 23, 2014 14:41
Terminator monokai theme (~/.config/terminator/config)
[global_config]
title_transmit_bg_color = "#4c4c4c"
title_inactive_fg_color = "#afafaf"
title_inactive_bg_color = "#2d2d2d"
[profiles]
[[default]]
palette = "#000000:#f92672:#6cc72c:#fe9720:#5f91ef:#9358fe:#36af90:#8c8c8c:#4c4c4c:#ff80f4:#a7e22e:#ffee99:#5fd9ef:#ae82fe:#66efd5:#c7cece"
use_system_font = False
foreground_color = "#ffffff"
font = DejaVu Sans Mono 10