Skip to content

Instantly share code, notes, and snippets.

View nullren's full-sized avatar

Renning Bruns nullren

View GitHub Profile

Keybase proof

I hereby claim:

  • I am nullren on github.
  • I am renning (https://keybase.io/renning) on keybase.
  • I have a public key whose fingerprint is A548 9568 DE98 0D13 A630 C3F9 54D0 8C5D 2C4C A4D2

To claim this, I am signing this object:

@nullren
nullren / derp_close.sh
Created May 10, 2014 04:15
both of these scripts are called using your image file as the argument
#!/bin/bash
if [ ! -f $1 ]; then
echo no file to close
exit 1
fi
LUFIL=$1
LODEV=$(losetup -j $LUFIL | cut -d: -f1)
@nullren
nullren / vimclip.sh
Created April 26, 2014 01:08
this is a little weird right now
#!/bin/bash
TMPFILE=$(mktemp --suffix=.vimclip)
vimedit.sh "$TMPFILE" "+:autocmd BufWritePost * ! xclip $TMPFILE"
@nullren
nullren / fake_population.R
Last active December 22, 2015 14:49
in a textbook, there was an example i recreated. first step was to create a random scattering of two populations in such a way that there would be some chance of correlation. the second step was to use two methods of classifying the population to predict the color of other members: least squares (the line separates red and blue populations); N-n…
# create random scattering of points, but cluster them together so
# that it at least looks like there are something to seperate or
# correlate. could have used rmvnorm probably, but did not know before
# i already finished.
nCenters <- 2
nPointsToGen <- 100
nNearNeighbor <- 5
# create 2 sets of 10 points (x,y). these will be the centers of the
<html>
<head>
<title>play something</title>
<link href="phoneplay.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
<a href="?">home</a>
<a href="?cmd=stop">stop</a>
<hr />
@nullren
nullren / helpers.c
Last active December 17, 2015 11:29
#include "helpers.h"
#include <math.h>
#include <stdlib.h>
uint64_t* sievePrimes(uint64_t* n)
{
if (*n < 2) return NULL;
char *primes = malloc(sizeof(char)*(*n+1)/2);
const uint64_t loop_limit = (sqrt(*n) + 1) /2;
/* Find the greatest product of five consecutive digits in the 1000-digit number.
*/
#include <stdio.h>
#include <string.h>
#define DIGITS 1000
#define SUBSEQUENCE_SIZE 5
int main()
/* Find the greatest product of five consecutive digits in the 1000-digit number.
*/
#include <stdio.h>
#include <string.h>
#define DIGITS 1000
#define SUBSEQUENCE_SIZE 5
int main()
@nullren
nullren / tweetcounter.py
Created April 29, 2013 06:16
i am trying to count how many recent tweets contain 'bitcoin' in their text... i don't think this is right.
#!/usr/bin/python
import json
import urllib.request as r
import urllib.parse as p
from datetime import datetime, timedelta
import pytz
now = pytz.UTC.localize(datetime.utcnow())
delta = timedelta(minutes=3)
@nullren
nullren / trans_srt.py
Created March 24, 2013 07:48
python script to translate my chinese srt files into english!
#!/usr/bin/python3
import sys
import re
import json
import html.parser
import urllib.parse as p
import urllib.request as r