Skip to content

Instantly share code, notes, and snippets.

@karolmajta
karolmajta / terrain.py
Created April 29, 2012 19:22
terrain.py for running lettuce with django
import logging
from django.core.management import call_command
from lettuce import before, after
import yourprojec.test_settings
@before.all
def before_all():
@karolmajta
karolmajta / feasts_pl.py
Created May 8, 2012 10:52
Utility to get all official public holidays in Poland for a given year.
from datetime import date, timedelta
FEASTS = (
(1, 1), # New Years Day
(1, 6), # Epiphany
(5, 1), # Work Day
(5, 3), # Constiturion Day
(8, 15), # Army Day
(11, 1), # All Saints
(11, 11), # Independence Day
@karolmajta
karolmajta / robot.js
Created December 4, 2012 21:33
TurboNiszczyciel
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.rotateCannon(2);
@karolmajta
karolmajta / robot.js
Created December 4, 2012 21:41
Niszczyciel2
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.rotateCannon(-2);
@karolmajta
karolmajta / fakebook.py
Last active December 15, 2015 04:28
Easily interact with your facebook applications test accounts
'''
Created on 19-03-2013
@author: karol
'''
import requests
import json
class FakebookException(Exception):
class PathBuilder(object):
"""
Super awsome url path builder:
>>> PathBuilder().access_tokens.fold()
>>> "/access-tokens"
>>> PathBuilder().access_tokens.list().fold()
>>> "/access-tokens/"
>>> PathBuilder().access_tokens(30).fold()
>>> "/access-tokens/30"
package main
// #include <stdio.h>
// #include <stdlib.h>
// #include <clp.h>
// int add(int x, int y) { return x + y; }
// int printInt(int x) { return printf("%d\n", x); }
import "C"
import (
@karolmajta
karolmajta / background.js
Created March 12, 2014 07:19
How to track
var current = null;
chrome.tabs.query({active: true}, function (tabs) {
current = tabs[0].id;
})
chrome.tabs.onCreated.addListener(function(t) {
current = t.id;
console.log(current);
});
@karolmajta
karolmajta / gtkrc
Last active August 29, 2015 13:57
Make eclipse less ugly in cinnamon
gtk-color-scheme = "selected_text_color:#000000"
style "compact"
{
GtkButton::default_border={0,0,0,0}
GtkButton::default_outside_border={0,0,0,0}
GtkButtonBox::child_min_width=0
GtkButtonBox::child_min_heigth=0
GtkButtonBox::child_internal_pad_x=0
GtkButtonBox::child_internal_pad_y=0
GtkMenu::vertical-padding=1
'use strict';
const pointsToFile = uri => /\/[^/]+\.[^/]+$/.test(uri);
exports.handler = (event, context, callback) => {
// Extract the request from the CloudFront event that is sent to Lambda@Edge
var request = event.Records[0].cf.request;
// Extract the URI from the request