Skip to content

Instantly share code, notes, and snippets.

View Kagee's full-sized avatar
👾
Still working from home, what about you?

Anders Einar Hilden Kagee

👾
Still working from home, what about you?
View GitHub Profile
[
{
"action":"said",
"timestamp":"18:04:16",
"message":"woooohooo :D",
"nick":"Anthonia_"
},
{
"action":"gained",
"timestamp":"18:04:25",
import sys # stdin
import re # regexp
import os
import json
qsize = 20;
filename = "chat.json"
smsg = re.compile(r"\[(\d{2}:\d{2}:\d{2})\] \[Server thread/INFO\]: (.*)")
chat = re.compile(r"<(.*)> (.*)")
#! /bin/bash
tail -F test.log| python parse.py
#! /bin/bash
tail -F server.log | python parse.py
@Kagee
Kagee / parse.py
Last active December 26, 2015 13:49
import sys # stdin
import re # regexp
import os
import json
qsize = 20;
chat_file = "chat.json"
users_file = "users.json"
DEBUG = False
function processDoc($docUrl) {
$doc = new DOMDocument();
$xpath = new DOMXpath($doc);
// Fortell PHP at atom:-tagger finnes (ikke reell DTD-URL):
$xpath->registerNamespace('atom', 'http://www.w3.org/2005/Atom/');
$config = array(
'input-xml' => true,
'output-xml' => true);
$tidy = new tidy;
$tidyXML = $tidy->repairFile($docUrl, $config, "utf8");
>>> inc
50
>>> base
1000
>>> sum = 0
>>> for i in range(0,356):
... sum = sum + (base + (inc*i))
...
>>> sum
3515500

Keybase proof

I hereby claim:

  • I am kagee on github.
  • I am kagee (https://keybase.io/kagee) on keybase.
  • I have a public key whose fingerprint is 7420 F6A6 BFB4 4940 34D8 300A 0581 5A81 1322 0715

To claim this, I am signing this object:

hildenae@grune ~/tmp/tmp $ echo "a" > A
hildenae@grune ~/tmp/tmp $ echo "b" > B
hildenae@grune ~/tmp/tmp $ echo "c" > C
hildenae@grune ~/tmp/tmp $ cat *
a
b
c
hildenae@grune ~/tmp/tmp $ echo "Irssi" > *
hildenae@grune ~/tmp/tmp $ cat *
Irssi
#define _GNU_SOURCE
#include <dlfcn.h>
#include <netdb.h>
#include <string.h>
typedef int (*getaddrinfo_t)(const char *node, const char *service,
const struct addrinfo *hints,
struct addrinfo **res);
int getaddrinfo(const char *node, const char *service,