Skip to content

Instantly share code, notes, and snippets.

View martincox's full-sized avatar

Martin Cox martincox

View GitHub Profile
@martincox
martincox / tmux.conf
Created April 28, 2017 21:44 — forked from spicycode/tmux.conf
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
-module(hofun).
-compile(export_all).
init() ->
PrepareAlarm = fun(Room) ->
io:format("Alarm set in ~s.~n",[Room]),
fun() -> io:format("Alarm tripped in ~s! Call Batman!~n",[Room]) end
end,
AlarmReady = PrepareAlarm("bathroom"),
<?xml version="1.0" encoding="utf-8"?>
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/grid_layout"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.getpillr.test.MainActivity">
</GridLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ff0"/>
</LinearLayout>
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.GridLayout;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@martincox
martincox / gist:0d67dfb1ab3c7403506e
Created February 16, 2015 11:29
Iterate DictReader
import csv
with open('file.csv') as input:
lines = csv.DictReader(input, delimiter='\t')
for line in lines:
print line['FC']
import csv
with open('file.csv') as input:
lines = csv.reader(input, delimiter='\t')
for line in lines:
print line[0]