Skip to content

Instantly share code, notes, and snippets.

def normalize_upper(data):
return ''.join(x for x in normalize('NFKD', (data or '').decode('utf-8')) if x in string.printable).encode('ASCII','ignore')
@kmila
kmila / alog.sh
Last active August 29, 2015 14:06 — forked from DavidEGx/alog.sh
#!/bin/bash
# Tail an apache log an put some colors into the output
# www.davideg.es
shopt -s expand_aliases
alias grey-grep="GREP_COLOR='1;30' grep -E --color=always --line-buffered"
alias red-grep="GREP_COLOR='1;31' grep -E --color=always --line-buffered"
alias green-grep="GREP_COLOR='1;32' grep -E --color=always --line-buffered"
alias yellow-grep="GREP_COLOR='1;33' grep -E --color=always --line-buffered"
@kmila
kmila / mvncolor.sh
Last active August 29, 2015 14:06 — forked from evocateur/mvncolor.sh
adapted from builddoctor/maven-antsy-color
#!/usr/bin/env bash
unalias mvn
unalias maven
unset -f mvn-color
alias maven="command mvn"
# Wrapper function for Maven's mvn command.
server {
listen 80;
server_name url.dev.infra;
location / {
proxy_pass http://url.dev.infra:3200;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@kmila
kmila / main.js
Created March 27, 2014 14:12 — forked from lessmilk/main.js
/*
Code of "Dark Bleu" game from www.lessmilk.com/10/
Made with Phaser Javascript framework
Note: the is the main source code. I skiped the boring part (preloading the assets, and the menus)
*/
/*
Programming and art made by www.lessmilk.com
You can freely look at the code below,
#!/usr/bin/env python
"""
http://www.openldap.org/faq/data/cache/347.html
As seen working on Ubuntu 12.04 with OpenLDAP 2.4.28-1.1ubuntu4
Author: Roberto Aguilar <[email protected]>
"""
import hashlib
import os
@kmila
kmila / start_screen.sh
Last active December 24, 2015 00:19
start_screen.sh
#!/bin/bash
if [ ! -f ~/.screenrc ]
then
cat << 'EOF' > ~/.screenrc
caption always "%w"
termcapinfo xterm ti@:te@
bindkey "^[[1;5D" prev
bindkey "^[[1;5C" next
@kmila
kmila / gist:6610978
Created September 18, 2013 15:33
mongodb_debug
db.setProfilingLevel(2) -> debug mode
db.system.profile.find().sort({$natural:-1}); -> example with first line representing last execution
db.setProfilingLevel(0) -> disables debug mode
db.coll_name.help()
mongoexport --collection coll_name --out /tmp/dump.json --db db_name
@kmila
kmila / freemarker_listVariables
Created September 2, 2013 17:45
List variables from freemarker file
// implementation-dependant (freemarker 2.3.14)
private List<String> getTemplateVariables(Template freemarkerTemplate) throws IOException, TemplateModelException {
SimpleSequence childNodes = (SimpleSequence) freemarkerTemplate.getRootTreeNode().getChildNodes();
List<String> dollarVariables = new ArrayList<String>();
for (Object object : childNodes.toList()) {
if (object instanceof TemplateElement && ((TemplateElement) object).getCanonicalForm().startsWith("$")) {
dollarVariables.add(((TemplateElement) object).getCanonicalForm());
}
}
return dollarVariables;

#Sublime Text 2 - Shortcuts (Mac OSX)

##Default

###General

Command Shortcut
Command palette + + P
Toggle side bar + K + B