Skip to content

Instantly share code, notes, and snippets.

@belak
belak / log_hook.go
Created July 1, 2016 22:58
Simple Logrus Sentry Hook
package log_hook
import (
"errors"
"github.com/Sirupsen/logrus"
"github.com/getsentry/raven-go"
)
// severityMap is a simple mapping of logrus log level to raven log
@belak
belak / .gitignore
Last active July 6, 2022 19:26
Simple Emacs Starter Kit
README.el
backups/
elpa/
projectile-bookmarks.eld
recentf
smex-items
@belak
belak / README.md
Last active March 14, 2023 01:48
IRC User Mode Tracking

IRC User Mode Tracking

This doc includes some random notes on implementing mode/presence tracking in IRC. Note that this implementation assumes we don't have access to any IRCv3 caps.

There is a rough implementation for go-irc here.

Simple cases

@belak
belak / keybase.md
Created October 16, 2014 18:47
keybase.md

Keybase proof

I hereby claim:

  • I am belak on github.
  • I am belak (https://keybase.io/belak) on keybase.
  • I have a public key whose fingerprint is 492B 23C7 1304 8F76 F624 246B BBEF 955F FDF1 29AB

To claim this, I am signing this object:

@belak
belak / utils.c
Last active August 29, 2015 14:06
Random C string utils
// NOTE: _GNU_SOURCE is required for this to work because of asprintf
#define _GNU_SOURCE
#include <stdarg.h>
#include <stdio.h>
// This function allocates a string, prints the formatted version to it and uses write to print it to stdout.
void waprintf(const char *fmt, ...) {
va_list args;
@belak
belak / .gitmodules
Last active August 29, 2015 14:04
Ville Minecraft Query
[submodule "mcstat"]
path = mcstat
url = https://github.com/winny-/mcstat.git
@belak
belak / mc-query.php
Last active August 29, 2015 14:00
Minecraft Stats Query
<?php
// Settings
$hostname = "66.240.202.11";
$port = 25565;
// Based off of https://github.com/winny-/mcstat/blob/master/mcstat.php
// with updated reading of the key-value and username portions.
$sess_id = rand(1, 0xFFFFFFFF) & 0x0F0F0F0F;
@belak
belak / mc-query.py
Last active August 29, 2015 13:58
Minecraft Stats Query
import json
import struct
import socket
# Minecraft varints are 32-bit signed values
# packed into Google Protobuf varints
# https://gist.github.com/nickelpro/7312782
import struct
def pack_varint(val):
@belak
belak / TMXTiledMapArtifactFixer.java
Last active August 29, 2015 13:58
Tileset Fixer
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import org.apache.commons.cli.BasicParser;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.HelpFormatter;
import requests
import gspread
gc = gspread.login('user@gmail.com', 'password')
wks = gc.open('Reddit Analysis Data').sheet1
# Grab the hot topics
r = requests.get("http://www.reddit.com/hot.json?limit=50")
j = r.json()
cols = ['title', 'author', 'over_18', 'url', 'permalink', 'created_utc', 'subreddit', 'num_comments', 'ups', 'downs', 'score']