Skip to content

Instantly share code, notes, and snippets.

@ohlol
ohlol / sample_jsonl.py
Last active June 10, 2018 08:09 — forked from rjurney/sample_jsonl.py
Create a random sample of records from a JSON Lines file
import json
import math
with open("data/repos.jsonl") as f:
records = [json.loads(x) for x in f]
count = len(records)
sample_count = math.ceil(.01*count)
sample_records = random.sample(records, sample_count)
#!/bin/sh
#
# requires httpie
while /bin/true
do
http --timeout 1 HEAD http://ocean.collinvandyck.com > /dev/null 2>&1
case "$?"
2)
@ohlol
ohlol / pbcmd.cpp
Created December 7, 2011 06:09 — forked from jgeboski/pbcmd.cpp
ZNC Playback on Command
/*
* Copyright (C) 2011 James Geboski <jgeboski@gmail.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*/
#include "Chan.h"
#include "Client.h"
@ohlol
ohlol / git-hook-functions.sh
Created October 11, 2011 16:31 — forked from evilchili/git-hook-functions.sh
function library for git hooks & a post-receive hook for automatic branch building
#!/bin/bash
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
if [ -z "$GIT_DIR" ]; then
echo >&2 "fatal: hooks/functions: GIT_DIR not set"
exit 1
fi
read oldrev newrev refname