This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import boto.ec2 | |
| instances = boto.ec2.connect_to_region('eu-west-1').get_all_instances() | |
| by_address = dict((r.instances[0].ip_address, r.instances[0].id) for r in instances) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function curl_json() { | |
| out=/tmp/curl_json.json | |
| echo > $out $out.err $out.pretty | |
| curl -s -H "Content-Type: application/json" -H "Accept: application/json" $@ > $out | |
| jq -s -C . < $out > $out.pretty 2>$out.err | |
| test -s $out.err && cat $out || cat $out.pretty | |
| echo | |
| } | |
| function curl_postjs() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (=<`$9]7<5YXz7wT.3,+O/o'K%$H"'~D|#z@b=`{^Lx8%$Xmrkpohm-kNi;gsedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543s+O<oLm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # Set up user-wide: | |
| # | |
| # 1) Copy this file to ~/.git_template/hooks/pre-commit | |
| # 2) git config --global init.templatedir '~/.git_template' | |
| # 3) New repos will initialize from template. Use 'git init' on existing repos to install manually. | |
| # | |
| # Conflict (from https://gist.github.com/danwerner/1006520) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val t1 = one.getTimestamp | |
| val t2 = other.getTimestamp | |
| if (t1 != null && t2 != null) { | |
| if (t1 < t2) { | |
| one.setValue(other.getValue) | |
| } | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <scheme name="dln" version="1" parent_scheme="Default"> | |
| <option name="LINE_SPACING" value="1.29" /> | |
| <option name="EDITOR_FONT_SIZE" value="16" /> | |
| <option name="CONSOLE_FONT_NAME" value="Monospaced" /> | |
| <option name="CONSOLE_FONT_SIZE" value="11" /> | |
| <option name="CONSOLE_LINE_SPACING" value="1.2" /> | |
| <option name="EDITOR_QUICK_DOC_FONT_SIZE" value="MEDIUM" /> | |
| <option name="EDITOR_FONT_NAME" value="Ubuntu Mono Unhinted" /> | |
| <colors> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| register /usr/lib/pig/piggybank.jar | |
| -- Data from: http://www.val.se/val/val2010/ledav/nuvarande_ledamoter_RLK.skv | |
| Ledamoter = load 'nuvarande_ledamoter_RLK.skv' using PigStorage(';') as ( | |
| valtyp:chararray, | |
| lsnr:chararray, | |
| l:chararray, | |
| kommunnr:chararray, | |
| kommun:chararray, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cmake_minimum_required (VERSION 2.8.6) | |
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") | |
| include(FindPkgConfig) | |
| pkg_check_modules(MEDIDA libmedida) | |
| include_directories(${MEDIDA_INCLUDE_DIRS}) | |
| link_directories(${MEDIDA_LIBRARY_DIRS}) | |
| add_executable(medida-example1 medida_example1.cc) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package foo.bar; | |
| public class BytesToHex { | |
| public static String bytesToHex(byte[] bytes) { | |
| StringBuilder builder = new StringBuilder(); | |
| for (byte b: bytes) { | |
| builder.append(String.format("%02x", b)); | |
| } | |
| return builder.toString(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Watch paths (given as arguments), automatically build when something changes. | |
| # The script does a couple opinionated things to make my life easier: | |
| # | |
| # * Terminal scrollbuffer is reset before each iteration, simplifying scrolling. | |
| # * I use a filter script to colorize gcc output (clang errors would be nicer). | |
| # * Output is copied to a log file (/tmp/build.log). | |
| # - I open this file in Sublime or vim, which reloads the file on change (each build). | |
| # | |
| # Usage: |