Skip to content

Instantly share code, notes, and snippets.

View sideb0ard's full-sized avatar

thorsten sideb0ard sideb0ard

View GitHub Profile
@sideb0ard
sideb0ard / ActivityA.java
Created April 25, 2016 02:36
Stackoverflow answer, "Singleton in Android"
package com.example.testSingleton;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;
public class ActivityA extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
@sideb0ard
sideb0ard / seppy.c
Created February 11, 2016 16:49
string separator
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct freaky {
int num_freaks;
int *freaks;
} freaky;
freaky* new_freqs_from_string(char* string)
#cloud-config
hostname: <%= shortname %>
ssh_authorized_keys:
- ssh-rsa xxxx rsa-key-20120604
coreos:
units:
- name: settimezone.service
command: start
@sideb0ard
sideb0ard / marky.go
Last active August 29, 2015 14:12
markov gold chains
package main
// bits of code gratutiously borrowed from https://golang.org/doc/codewalk/markov/
import (
"bufio"
"fmt"
"io"
"math/rand"
"os"
@sideb0ard
sideb0ard / boring.go
Created December 2, 2014 00:55
Boring go from Rob Pike, Google IO 2012
package main
import (
"fmt"
//"math/rand"
//"time"
)
type Message struct {
str string
@sideb0ard
sideb0ard / philosorpator.go
Created November 18, 2014 15:53
Dining Philosoraptors with Channels as Semaphores
package main
import (
"fmt"
"math/rand"
"time"
)
type Philosopher struct{}
@sideb0ard
sideb0ard / heroku2psql_format_logs.pl
Last active August 29, 2015 14:07
heroku2psql_format_logs.pl
#!/usr/bin/perl -w
use strict;
use Time::Piece;
die "Ooft, mate, i need an input file\n" unless (scalar @ARGV == 1);
my $date = localtime->strftime('%m-%d-%Y');
my $infile = $ARGV[0];
my $outfile = $infile . ".$date";
open(FILE, $infile) || die "Cannae open yer file, buddy\n";
### Keybase proof
I hereby claim:
* I am sideb0ard on github.
* I am sideb0ard (https://keybase.io/sideb0ard) on keybase.
* I have a public key whose fingerprint is 612E 4F5B 6AC2 3248 70CB 8484 24F3 D920 4EC7 80FF
To claim this, I am signing this object:
package main
import (
"bytes"
"fmt"
"log"
"os"
"strconv"
)
package main
import (
"bytes"
"fmt"
"log"
"os"
"strings"
)