Skip to content

Instantly share code, notes, and snippets.

@clsr
clsr / read_line.c
Created June 30, 2013 18:29
read a line until a newline or EOF, allocating and resizing an array as necessary
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define READ_LINE_BUFFER 1024
char *read_line(FILE *f)
{
char *line, *l;
size_t linelen;
@clsr
clsr / 1288.user.js
Last active December 27, 2015 19:19
Implementation of http://xkcd.com/1288/ as a userscript
// ==UserScript==
// @name xkcd 1288 substitutions
// @namespace http://github.com/mcef
// @description Substitutions that make reading the news more fun
//
// @include http://www.bbc.com/*
// @include http://www.cbc.ca/*
// @include http://www.theguardian.com/*
// @include http://www.telegraph.co.uk/*
// @include http://www.theonion.com/*
@clsr
clsr / dwmclock.c
Created August 26, 2014 18:42
Show a clock and battery percentage in X root tile (for dwm)
#define _GNU_SOURCE
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <X11/Xlib.h>
@clsr
clsr / intconv.go
Created November 25, 2014 10:35
Convert integers between different bases
package main
import (
"flag"
"fmt"
"github.com/clsr/intcodec"
"os"
"strings"
)
@clsr
clsr / FuckFuckFuckAdBlock.js
Last active January 7, 2016 02:22
Fixes FuckFuckAdBlock.user.js' modifications to window.fuckAdBlock
/*
This software is released into public domain.
It is provided "as is", without warranties or conditions of any kind.
Anyone is free to use, modify, redistribute and do anything with this software.
*/
if (!(window.fuckAdBlock instanceof window.FuckAdBlock)) {
var fab = new window.FuckAdBlock(window.fuckAdBlock._options);
for (var field in fab) {
window.fuckAdBlock[field] = fab[field];

Keybase proof

I hereby claim:

  • I am clsr on github.
  • I am clsr (https://keybase.io/clsr) on keybase.
  • I have a public key ASC3_9p0Sxv69wbH5G9YW8j2_2nh_exXoIB5O5MLetDVYQo

To claim this, I am signing this object: