Skip to content

Instantly share code, notes, and snippets.

View TkTech's full-sized avatar
Converting coffee into code

Tyler Kennedy TkTech

Converting coffee into code
View GitHub Profile
> % python silly_ip.py
There are 1 items in the 74 bucket.
(74, 125, 232, 201) 1
(74, 125, 232, 211) 1
(74, 125, 232, 206) 1
There are 1 items in the 79 bucket.
(79, 115, 74, 141) 1
-> % python silly_ip.py
{74: {125: {232: {211: 1, 20174: 1}}}, 79: {115: {74: {141: 1}}}}
nbt = NBTFile('out.nbt')
for name, tag in nbt.value.iteritems():
print name, tag
@TkTech
TkTech / pymineweb.py
Created March 13, 2012 06:45
Easy functions for playing with minecraft.net
#!/usr/bin/env python
# -*- coding: utf8 -*-
import re
import requests
# Regex used for authentication token.
_token_r = re.compile(r'name="authenticityToken" value="([0-9a-f]+)">')
# Regex used for server list entries.
_list_r = re.compile(
#!/usr/bin/env python
# -*- coding: utf8 -*-
import re
import requests
# Regex used for authentication token.
_token_r = re.compile(r'name="authenticityToken" value="([0-9a-f]+)">')
# Regex used for server list entries.
_list_r = re.compile(
* r3fuze
* Mischgasm
* iceli3
* fdsafd
* Symbicore
* ThePhoenix82
* Live4Chaos
* zumog
* b4bingo
* JasonFCP
Delivered-To: -snip-
Received: by 10.220.85.208 with SMTP id p16cs125450vcl;
Sat, 7 Jan 2012 16:12:54 -0800 (PST)
Received: by 10.182.197.10 with SMTP id iq10mr9514889obc.75.1325981573007;
Sat, 07 Jan 2012 16:12:53 -0800 (PST)
Return-Path: <mcbans@ddoscom.in>
Received: from bha (ddoscom.in. [176.31.206.194])
by mx.google.com with ESMTPS id zl3si13520493obb.65.2012.01.07.16.12.49
(version=TLSv1/SSLv3 cipher=OTHER);
"packets": {
"info": {
"count": 65
},
"packet": {
"0": {
"class": "wf",
"from_client": true,
"from_server": true,
"id": 0,
@TkTech
TkTech / gist:923628
Created April 17, 2011 00:02
Decimal to Base36
#include <stdio.h>
#include <stdint.h>
#include <string.h>
char *base36 = "0123456789abcdefghijklmnopqrstuvwxyz";
void encode36(char *buffer, uint64_t num) {
for(num=num; num > 0; num /= 36) {
*buffer++ = base36[num % 36];
}
#!/usr/bin/env python
# encoding: utf-8
"""
Copyright (C) 2011 by Tyler Kennedy <tk@tkte.ch>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is