Skip to content

Instantly share code, notes, and snippets.

@torhve
torhve / blue.css
Last active September 23, 2016 11:30
battle.net gb
@import "dark.css";
body {
background-color: #1d222c;
color: #dfdfcf;
}
a {
color: #0787c1;
}
.btn-primary {

Keybase proof

I hereby claim:

  • I am torhve on github.
  • I am thveem (https://keybase.io/thveem) on keybase.
  • I have a public key whose fingerprint is B574 0C67 9045 A093 1F04 47AC 7C3E CF78 51B7 F195

To claim this, I am signing this object:

function is_url_in_buffer(buffer, url)
lines = weechat.hdata_pointer(weechat.hdata_get('buffer'), buffer, 'own_lines')
line = weechat.hdata_pointer(weechat.hdata_get('lines'), lines, 'first_line')
hdata_line = weechat.hdata_get('line')
hdata_line_data = weechat.hdata_get('line_data')
while line do
data = weechat.hdata_pointer(hdata_line, line, 'data')
message = weechat.hdata_string(hdata_line_data, data, 'message')
if string.find(message, url) then
return true
ก็็็็็็็็็็็็็ʕ•͡ᴥ•ʔ ก้้้้้้้้็็็็็็
ก็็็็็็็็็็็็็ʕ•͡ᴥ•ʔ ก้้้้้้้้็็็็็็
ก็็็็็็็็็็็็็ʕ•͡ᴥ•ʔ ก้้้้้้้้็็็็็็
ก็็็็็็็็็็็็็ʕ•͡ᴥ•ʔ ก้้้้้้้้็็็็็็
ก็็็็็็็็็็็็็ʕ•͡ᴥ•ʔ ก้้้้้้้้็็็็็็
ก็็็็็็็็็็็็็ʕ•͡ᴥ•ʔ ก้้้้้้้้็็็็็็
ก็็็็็็็็็็็็็ʕ•͡ᴥ•ʔ ก้้้้้้้้็็็็็็
ก็็็็็็็็็็็็็ʕ•͡ᴥ•ʔ ก้้้้้้้้็็็็็็
ก็็็็็็็็็็็็็ʕ•͡ᴥ•ʔ ก้้้้้้้้็็็็็็
ก็็็็็็็็็็็็็ʕ•͡ᴥ•ʔ ก้้้้้้้้็็็็็็
@torhve
torhve / irssilogparser.py
Created August 23, 2013 12:51
A script to parse irssi log files and put URLs into postgresql supports two codecs, utf-8 and iso-8859-1. supports norwegian and us local for day changed messages
#!/usr/bin/env python
# A script to parse irssi log files and put URLs into postgresql
# supports two codecs, utf-8 and iso-8859-1.
# supports norwegian and us local for day changed messages
# author: xt <xt@bash.no>
import codecs
import sys
import psycopg2
import re
@torhve
torhve / rss-update.lua
Created April 3, 2013 15:51
use postgresql "upsert" using writable CTE (psql 9.1 feature)
-- use postgresql "upsert" using writable CTE (psql 9.1 feature)
local sql = [[
WITH new_values (rss_feed, guid, title, url, pubDate, content) AS (
VALUES
]]..sprintf('(%s, %s, %s, %s, %s::timestamp, %s)', rss_feed, quote(guid), quote(e.title), quote(e.link), quote(e.updated), quote(content))..[[
),
upsert as
(
UPDATE rss_item m
SET rss_feed = nv.rss_feed,
diff --git a/src/plugins/lua/weechat-lua.c b/src/plugins/lua/weechat-lua.c
index cdd4990..e8a203d 100644
--- a/src/plugins/lua/weechat-lua.c
+++ b/src/plugins/lua/weechat-lua.c
@@ -236,6 +236,7 @@ weechat_lua_exec (struct t_plugin_script *script, int ret_type,
return NULL;
}
+ lua_pop(lua_current_interpreter, 1);
lua_current_script = old_lua_current_script;
@torhve
torhve / socat.py
Created March 4, 2013 11:54
socat and wsproxy modules
#!/usr/bin/env python
'''
Support for socat
'''
# Import python libs
import os
import glob
# Import salt libs
#!/usr/bin/env python
# Author: Tor Hveem
import sys
import PAM
import sqlite
import os
import re
import urllib2
import logging
@torhve
torhve / drawbars.js
Created January 25, 2013 23:08
drawbars
define(function(require) {
'use strict';
var d3 = require('d3');
return function (keys, values, keyfmt, valfmt, el) {
/* Init defaults */
var chart,
width = 800,