Skip to content

Instantly share code, notes, and snippets.

@kmila
kmila / Main.java
Created November 29, 2012 15:49
CRUCIBLE REST API
import static java.lang.Math.min;
import static java.lang.String.format;
import static java.lang.System.getProperty;
import static java.nio.charset.Charset.defaultCharset;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.concurrent.Callable;
@kmila
kmila / 7za.bat
Last active October 13, 2015 08:48
7za
"zip
@echo off
set arg1=%*
@echo on
_7za.lnk a -tzip %1.zip %arg1%
pause
"unzip
set arg1=%1
pause
_7za.lnk x %arg1% -o%1_dir
@kmila
kmila / nanorc.sh
Last active December 13, 2015 23:19
nanorc for log4j
#.nanorc
# logging syntax highlighting
#
# * initially based on log-stuff.nanorc (github.com/mattpowell/.nanorc), changed completely to adapt to log4j.
syntax "logs" "\.*(out|err|log|tdump|hprof)\.*$"
# markers and keywords
color brightwhite "[[:punct:]]"
color brightwhite start="(\[|<|\{|\()" end="(\]|>|\}|\))"
color brightblack "(\[|\{|\(|<|\]|\}|\)|>)"
@kmila
kmila / log4j_udl.xml
Last active December 19, 2019 19:24 — forked from mmdemirbas/LogFile.udl.xml
Notepad++/Scintilla UDL to enable log4j syntax highlighting
<NotepadPlus>
<UserLang name="log4j" ext="log">
<Settings>
<Global caseIgnored="yes" />
<TreatAsSymbol comment="no" commentLine="no" />
<Prefix words1="no" words2="no" words3="no" words4="yes" />
</Settings>
<KeywordLists>
<Keywords name="Delimiters">[(0])0</Keywords>
<Keywords name="Folder+"></Keywords>
@kmila
kmila / log4j_udl.xml
Last active September 28, 2016 12:29
Notepad++ (UDL2) to enable log4j syntax highlighting (solarized edition)
<NotepadPlus>
<UserLang name="log4j_dark" ext="log" udlVersion="2.1">
<Settings>
<Global caseIgnored="yes" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="yes" Keywords3="no" Keywords4="yes" Keywords5="no" Keywords6="yes" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments"></Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>

#Sublime Text 2 - Shortcuts (Mac OSX)

##Default

###General

Command Shortcut
Command palette + + P
Toggle side bar + K + B
@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;
@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 / 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
#!/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 <roberto@baremetal.io>
"""
import hashlib
import os