Skip to content

Instantly share code, notes, and snippets.

View ThiefMaster's full-sized avatar
🐈
Scratching your code.

Adrian ThiefMaster

🐈
Scratching your code.
  • CERN / @indico
  • Geneva, Switzerland
View GitHub Profile
class CrazyBuffer(object):
def __init__(self):
self._buffer = StringIO()
def write(self, data):
self._buffer.write(data)
def close(self):
pass
def get_value(self):
return self._buffer.getvalue()
def reset(self):
@ThiefMaster
ThiefMaster / regex.py
Last active December 29, 2020 13:09
import sys
class ParseError(ValueError):
pass
class Regex(object):
def __init__(self, tree):
self.tree = tree
def from_sqlalchemy(self, obj)
from sqlalchemy.orm import class_mapper, ColumnProperty
columns = [prop.key for prop in class_mapper(obj.__class__).iterate_properties
if isinstance(prop, ColumnProperty)]
for column in columns:
if column in self:
self[column].data = getattr(obj, column)
" Remove trailing whitespace
fun! StripTrailingSpaces()
if (&ft=='markdown')
finish
endif
normal ms
%s/\s\+$//e
call histdel("/", -1)
normal `s
endfun
Uint8Array.prototype.indexOfMulti = function(searchElements, fromIndex) {
fromIndex = fromIndex || 0;
var index = Array.prototype.indexOf.call(this, searchElements[0], fromIndex);
if(searchElements.length === 1 || index === -1) {
// Not found or no other elements to check
return index;
}
for(var i = index, j = 0; j < searchElements.length && i < this.length; i++, j++) {
1. Was zeichnet Data Mining gegenüber Mustererkennung aus? !!!
DM ist die Analyse von großen Datenbeständen nach neuem, nützlichen Wissen.
2. Abgrenzung DM / Information Retrieval
- "Googlesuche nach Stichwort": IR
- "Gruppierung der Resultate nach Sprache": DM
- Klickpfadanalyse: DM
- Bildersuche in Personendatenbank: IR
@ThiefMaster
ThiefMaster / reason-to-hate-oracle-java.txt
Created January 28, 2013 11:58
And that's why I hate oracle and java.
* Due to Oracle no longer providing the distro-friendly DLJ bundles, the package
* has become fetch restricted again. Alternatives are switching to
* dev-java/icedtea-bin:6 or the source-based dev-java/icedtea:6
*
* Oracle requires you to download the needed files manually after
* accepting their license through a javascript capable web browser.
*
* Downlod the following files:
* jdk-6u38-linux-x64.bin
* at 'http://www.oracle.com/technetwork/java/javase/downloads/jdk6u38-downloads-1877406.html'
"use strict";
var request = require('request'),
cheerio = require('cheerio');
function loginSEOpenID(email, password, callback) {
console.log('SE OpenID: Loading login form');
request.get({
url: 'https://openid.stackexchange.com/account/login'
}, function(error, response, body) {
#!/bin/bash
tmux new-session -d
WIN=$(tmux new-window -dP)
tmux select-layout -t "$WIN" tiled
local avatar = ARGV[1]
local user_events = redis.call('ZRANGE', 'user_events:'..avatar, 0, -1)
local res = {}
for i, event in ipairs(user_events) do
res[event] = redis.call('SMEMBERS', 'user_event_roles:'..avatar..':'..event)
end
return cjson.encode(res)