Skip to content

Instantly share code, notes, and snippets.

@ChimeraCoder
ChimeraCoder / .screenrc
Created September 25, 2012 19:11
Screenrc with hardstatus line
escape \000\040
bind n focus down
bind ^n focus down
bind p focus up
bind ^p focus up
bind k next
bind ^k next
bind j prev
bind ^j prev
@ChimeraCoder
ChimeraCoder / gist:3792197
Created September 27, 2012 04:41
Java int vs Integer Example
ArrayList<Integer> someNumbers= new ArrayList<Integer>();
ArrayList<int> luckyNumbers= new ArrayList<int>();
//This will cause a compiletime error
//
JavaExample.java:23: unexpected type
found : int
required: reference
ArrayList<int> luckyNumbers= new ArrayList<int>();
@ChimeraCoder
ChimeraCoder / PythonBindings.py
Created September 27, 2012 04:52
Python class rebinding example
from __future__ import print_function
class Foo(object):
apple = "red"
def __init__(self, banana):
self.banana = banana
Bar = Foo
@ChimeraCoder
ChimeraCoder / PythonPrototypicalInheritanceEx.py
Created September 27, 2012 05:01
Python Prototypical Inheritance Example
from __future__ import print_function
class Foo(object):
apple = "red"
def __init__(self, banana):
self.banana = banana
tmp = Foo("yellow")
@ChimeraCoder
ChimeraCoder / Makefile
Created September 29, 2012 18:57
Test for environment variable
#Taken from
#http://stackoverflow.com/questions/4728810/makefile-variable-as-prerequisite
#Remember that each make target is run within a separate sub-shell, which defaults to sh (not bash)
#so bash-specific default environment variables like $HOSTNAME will *not* be accessible *unless*
# they are exported *before* `make' is run; ie, `export HOSTNAME=$HOSTNAME'
change-hostname: assertenvar-USER assertenvar-TESTVAR assertenvar-HOSTNAME assertenvar-TEF
assertenvar-%:
@if [ -z ${${*}} ] ; then \
@ChimeraCoder
ChimeraCoder / gist:3824532
Created October 3, 2012 02:09
Sample template info passing
func serveEventCreate(w http.ResponseWriter, r *http.Request, cred *oauth.Credentials){
if cred == nil {
respond(w, homeLoggedOutTmpl, nil)
} else {
respond(w, eventCreateTmpl, nil)
}
var twitter_id string
if err := getCookie(r, "twitter_id", &twitterInfo); err != nil {

Tweeting on behalf of users is bad

I just got trapped by Prismatic who tweeted a metric ton of messages on my twitter account. I do not want to pick on Prismatic who is probably a great product otherwise. However this is clearly a pattern that we've all seen too many times and this has to stop.

Before anything else, I could have very well done a mistake and hit the wrong buttons/settings. I am not putting the blame on Prismatic, but on this crazy system that allows machines to post on my behalf. No matter what, though, they should obviously prevent me from doing something that dumb, if that's my fault.

What happened

id := line[0]
length , err := strconv.ParseInt(line[1], 10, 64)
if err != nil{
log.Printf("Error parsing duration - empty? %v", err)
length = 0
}
//The DAY component of this may be wrong, but the time will be correct, in GMT
//The day will be an arbitrary day between 1970 and 1974. Ignore it.
time, err := strconv.ParseInt(line[2], 10, 64)
@ChimeraCoder
ChimeraCoder / .vimrc
Created January 16, 2013 20:53
Bare-bones .vimrc
syn on
set autoindent
set expandtab
set tabstop=4
set shiftwidth=4
set nu
set nocompatible
filetype indent on
filetype plugin on
colorscheme delek
@ChimeraCoder
ChimeraCoder / .inputrc
Created January 16, 2013 20:57
Basic .inputrc to allow smart search
$include /etc/inputrc
#Enables history search
"\e[A":history-search-backward
"\e[B":history-search-forward