Skip to content

Instantly share code, notes, and snippets.

package main
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa
#import <Cocoa/Cocoa.h>
#import <Foundation/Foundation.h>
#import <IOBluetooth/IOBluetooth.h>
void call_objc_example(void) {
package main
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa
#import <Cocoa/Cocoa.h>
void call_objc_example(void) {
NSLog(@"from objective-c");
}
@tmc
tmc / hn.sh
Last active December 20, 2015 02:39
cd /tmp
if [[ "`uname`" == 'Linux' ]]; then
curl -so go.tar.gz http://go.googlecode.com/files/go1.1.1.linux-amd64.tar.gz
else
curl -so go.tar.gz http://go.googlecode.com/files/go1.1.1.darwin-amd64.tar.gz
fi
tar xf go.tar.gz
export GOPATH=/tmp
export GOROOT=/tmp/go
@tmc
tmc / duration.go
Last active December 19, 2015 09:59
// parses arguments into a time duration and prints the number of seconds it represents
package main
import (
"fmt"
"os"
"strings"
"time"
)
#!/bin/sh
set -e
MTIME=$(date -r $1 +%s)
EXPDELTA=$(cat $1)
NOW=$(date +%s)
expr $MTIME + $EXPDELTA - $NOW \< 0
@tmc
tmc / about.html
Last active November 18, 2023 08:42
golang templating approach
{{define "extra_head"}}{{end}}
{{define "nav"}}
<li><a href="/">Home</a></li>
<li class="active"><a href="#">About</a></li>
<li><a href="/contact">Contact</a></li>
<li><a href="/privacy">Privacy</a></li>
{{end}}
{{define "content"}}
<div class="row-fluid marketing">
@tmc
tmc / run_revel_on_heroku.sh
Created November 19, 2012 04:50
run revel app on heroku
☭ ~ $ revel new sweet_app
☭ ~ $ cd sweet_app/
☭ ~/sweet_app $ git init
☭ ~/sweet_app (master)$ cat > .godir
sweet_app
^C
☭ ~/sweet_app (master)$ git add .godir *
☭ ~/sweet_app (master)$ git ci -m"Initial"
☭ ~/sweet_app (master)$ heroku create --buildpack https://github.com/robfig/heroku-buildpack-go-revel.git
☭ ~/sweet_app (master)$ git push heroku
@tmc
tmc / gist:4054110
Created November 11, 2012 07:50
wat django
#views.py
def link_accounts(request):
if request.method == 'POST': # If the form has been submitted...
#De-listify the stupid freakin' post request11!!11
form = LinkForm(initial=init) # A form bound to the POST data
print "HEREEEEEE"
if form.is_valid(): # All valid
<project-report>
<project-name>lab5</project-name> **Required
<upload-date>NONE</upload-date> **Required
<upload-updated>NONE</upload-updated> **Required
<due-date>2011-10-20 00:00:00</due-date> **Required
<section-name>W</section-name> **Required
<grader-name>GRADER_Last</grader-name> **Required
<student-info> **Required
<student-name>Barish,David</student-name> **Required
<student-kuid>3450008</student-kuid> **Required
Version = 5
Booleans = {'caretLineVisible': True, 'preferFixed': True, 'useSelFore': True}
CommonStyles = {'attribute name': {'fore': 13236445},
'attribute value': {'fore': 3100463},
'bracebad': {'back': 6710886, 'bold': 1, 'fore': 13421823},
'bracehighlight': {'bold': 1, 'fore': 16777215},
'classes': {'fore': 8578762},
'comments': {'fore': 10066329, 'italic': False},