Skip to content

Instantly share code, notes, and snippets.

frnhr / .bash_profile
Created Mar 17, 2016
Show current pyenv python version in bash prompt, and also color virtual envs differently
View .bash_profile
#### pyenv-virtualenv bash prompt customization
# pyenv
eval "$(pyenv init -)"
# pyenv-virtualenv:
frnhr /
Last active Oct 28, 2020 — forked from ObserverOfTime/
A form field to handle validation of image + svg, Django 3.1
from django.core import validators
from lxml import etree
from django.core.exceptions import ValidationError
from django.forms import ImageField
# monkeypatch allowed file extensions:
_original = validators.get_available_image_extensions
validators.get_available_image_extensions = lambda: _original() + ["svg"]
frnhr / qtranslate_cleanup.sql
Last active Oct 28, 2020
clean database after qTranslate uninstall
View qtranslate_cleanup.sql
# create temp column to separate post content on <!--more--> tag to simplify queries
ALTER TABLE `wp_posts` ADD `tmp_excerpt` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
# split content
## fill `tmp_exceprt` column
UPDATE wp_posts SET tmp_excerpt =
frnhr /
Created Jan 30, 2017
StopLight IO workflow for hosted docs from Django Rest Framework docstrings


One-time only.

  1. We export a Swagger spec file (api_swagger.json) from DRF code and import it into StopLight as a new API, first version.
  2. Commit this file on dev branch on GitHub.
  3. In StopLight we make any necessary changes:
    • assign groups to the API endpoints
    • we should not edit descriptions that were imported, because of possible Git merge conflicts later on
  4. Export a Swagger spec file from StopLight.
View gist:b9d597458c73c7a33f1bc18f0dc652e5
#taken from //
#the "forever" part taken from //
#thanks to [Ryan s]( and [Dave Stevens](
mkdir -p $HOME/src
cd $HOME/src
wget ''
tar -xzf node-v0.8.9.tar.gz
cd node-v0.8.9
frnhr / uncheckable_radio.js
Created Nov 1, 2012
uncheckable radio buttons
View uncheckable_radio.js
* Uncheckable radio buttons o_O
* usage:
* <input type="radio" name="something" class="uncheckable" />
$('input[type=radio].uncheckable').on('click', function(event){
var $this = $(this);
var was_checked = $'checked');
$('input[name='+$this.prop('name')+']').data('checked', false);
frnhr / gist:84a6593459986cce3ebc
Created Jul 31, 2015
Usage patterns for MeteoDoc2CSV
View gist:84a6593459986cce3ebc
MeteoDoc2CSV 0.0.1
Parse Word files of a proprietary format into CSV files.
Usage: <input_file>... [-o=<output_file>] <input_file>... [--append=<append>] [--prepend=<prepend>] -d <input_dir> [--append=<append>] [--prepend=<prepend>] [--join] (-h | --help) --version