Skip to content

Instantly share code, notes, and snippets.

View Kha's full-sized avatar

Sebastian Ullrich Kha

View GitHub Profile
// ==UserScript==
// @name DomJudge IP
// @namespace http://nullrich.de
// @include http://domjudge.iti.uni-karlsruhe.de/*/submissions.php*
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// ==/UserScript==
function deserialize(name, def) {
return eval(GM_getValue(name, (def || '({})')));
}
--- a/src/handlers.c
+++ b/src/handlers.c
@@ -717,6 +717,7 @@ int handle_window_type(void *data, xcb_connection_t *conn, uint8_t state, xcb_wi
*/
static bool handle_normal_hints(void *data, xcb_connection_t *conn, uint8_t state, xcb_window_t window,
xcb_atom_t name, xcb_get_property_reply_t *reply) {
+ return true;
Con *con = con_by_window_id(window);
if (con == NULL) {
DLOG("Received WM_NORMAL_HINTS for unknown client\n");
Input-, Output-Klassen, Buffer-Properties:
Node.cs:
public class Output {
public Node Node;
public int Index;
public Frame Buffer;
}
public class Input {
public Input Source;
public Frame Buffer;
@Kha
Kha / post-commit
Created November 18, 2011 20:13
Send git commit message to Pidgin chat room
#! /usr/bin/python2.7
# copy into .git/hooks
# dependencies: python2 dbus-python
import subprocess, dbus
room = "blub@conference.jabber.ccc.de"
bus = dbus.SessionBus()
obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject")
@Kha
Kha / rc.part.lua
Created October 30, 2011 22:00
Mod+Ctrl+o: Move all clients of active tags to next screen
globalkeys =
...
-- Move all clients of active tags to next screen
awful.key({ modkey, "Control" }, "o",
function ()
for i,t in ipairs(screen[mouse.screen]:tags()) do
if t.selected then
for j,c in ipairs(t:clients()) do
awful.client.movetoscreen(c)
int dist(string a, string b) {
int n = a.length(), m = b.length();
vector<int> row(m+1), prev(m+1);
// y == 0
for (int x = 0; x <= m; x++) row[x] = x;
for (int y = 1; y <= n; y++) {
swap(prev, row);
type LinearFunc = { M : float; B : float }
type Point = { X : float; Y : float }
let sqr x = x * x
let frac x = x - floor x
let calc f x = { X = x; Y = f.M * x + f.B }
let plusMinus delta dx = { -delta..dx..delta }
[<Struct>]
type Point (x : int, y: int) =
new (i : int) = Point (i,i)
member p.X = x
member p.Y = y
static member (+) (p : Point, q : Point) = Point (p.X + q.X, p.Y + q.Y)
static member (-) (p : Point, q : Point) = Point (p.X - q.X, p.Y - q.Y)
static member (|Point|) (p : Point) = p.X,p.Y
static member DistanceSqr (p : Point) (q : Point) = sqr (p.X - q.X) + sqr (p.Y - q.Y)
public static Expression<Func<T,V>> Bind<T, U, V>(Expression<Func<T, U>> f1, Expression<Func<U, V>> f2)
{
var param = Ex.Parameter(typeof(T), "hi");
return Ex.Lambda<Func<T, V>>(
Ex.Invoke(f2,
Ex.Invoke(f1, param)),
param);
}
class Category
{
// wiee, kein notify-Keyword :( ?
public string Header { get; set; }
public string Id { get; set; }
// two-way bound
public bool IsExpanded { get; set; }
public bool IsSelected { get; set; }
public ObservableCollection<Category> SubCategories { get; private set; }