Skip to content

Instantly share code, notes, and snippets.

View attilaolah's full-sized avatar
🌿
Namespacing.

Attila Oláh attilaolah

🌿
Namespacing.
View GitHub Profile
@attilaolah
attilaolah / urllibbench.py
Created July 17, 2013 23:30
Generate urllib2 vs. urllib3 benchmark results, as described here: http://attilaolah.eu/2010/08/08/urllib-benchmark/
import csv
import random
import re
import time
import urllib2
import urllib3
any_protocol = re.compile('^[^#^\\?^/]+?:')
@attilaolah
attilaolah / batterymonitor.lua
Created July 18, 2013 00:00
Awesome WM battery monitor and CPU monitor widgets.
-- Hex converter, for RGB colors
function hex(inp)
return inp > 16 and string.format("%X", inp) or string.format("0%X", inp)
end
-- Battery monitor
mybattmon = widget({ type = "textbox", name = "mybattmon", align = "right" })
function battery_status ()
local output={} -- output buffer
local fd=io.popen("acpitool -b", "r") -- list present batteries
@attilaolah
attilaolah / ppinitialize.c
Created July 18, 2013 00:43
LD_PRELOAD example for the closed-source fglrx driver.
#define _GNU_SOURCE 1
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <dlfcn.h>
long PP_Initialize(void) {
fp = fopen("/dev/stderr", "a");
fprintf(fp, "DEBUG: entering PP_Initialize.\n");
@attilaolah
attilaolah / mesq.py
Created July 18, 2013 00:47
Python-only example of python modular exponentiation by squaring, similar to built-in pow().
import sys
try:
rng = xrange
except NameError:
rng = range # Python 3+
def mesq(base, exp, mod, debug=False):
@attilaolah
attilaolah / update.sh
Created August 9, 2013 16:22
Google Now wallpaper changer
#! /usr/bin/env sh
# Execute this file:
# - when logging in
# - from a cron job whet the day of time changes (see below)
# An improved version could probably get the location from
# the internet, and use that to figure out sunrise/sunset times.
# Select a random directory.
@attilaolah
attilaolah / git-aliases.sh
Last active December 27, 2015 01:29 — forked from matthieua/git-aliases
git aliases for command line ninjas
alias g='git status'
alias gb='git branch'
alias gd='git diff'
alias gdm='git diff master'
alias gl='git log'
alias ga='git add'
alias gaa='git add -p .'
alias gco='git checkout'
alias gc='git commit -v'
alias gca='git commit -v -a'
@attilaolah
attilaolah / DHT11_BMP180_server.ino
Last active September 24, 2017 14:20
HTTP JSON API: ENC28J60 + DHT11 + BMP180 + UNO
// HTTP JSON API.
#include <EtherCard.h>
#include <DHT.h>
#include <Wire.h>
#include <Adafruit_BMP085_U.h>
// Ethernet:
POLYGON((397286.916999997 4795599.52079938,397311.239399999 4795618.50309938,397310.943099998 4795630.07069938,397320.138199999 4795639.56189938,397341.493999998 4795640.45119938,397359.587199995 4795646.08619938,397372.638100001 4795651.42479938,397389.248199998 4795654.39039938,397404.968599999 4795660.02549938,397443.943599998 4795687.60889938,397450.765699999 4795688.79519938,397482.7994 4795688.49759939,397497.630599999 4795717.26819938,397511.868699999 4795751.55569938,397535.301099996 4795767.27529938,397556.3605 4795773.50339938,397569.411400001 4795778.24869938,397583.055700003 4795787.44319938,397599.666199999 4795805.83239938,397613.607199998 4795819.77259938,397630.810399997 4795817.39929938,397665.632100003 4795818.16949939,397679.869599999 4795828.84699938,397695.886399995 4795827.66009938,397711.606899999 4795838.33749938,397760.547799995 4795856.72579938,397791.394699999 4795846.34359939,397801.182600001 4795841.89429938,397851.724599999 4795842.48609938,397880.495999997 4795856.72239938,39789
@attilaolah
attilaolah / jq.BUILD
Last active November 25, 2018 09:14 — forked from benley/jq.BUILD
bazel build jq
licenses(["notice"])
cc_binary(
name = "jq",
visibility = ["//visibility:public"],
srcs = glob([
"*.h",
"*.c",
]),
copts = [
@attilaolah
attilaolah / .XCompose
Last active January 9, 2020 15:14
ChromeOS ATM NumPad
include "%L"
<KP_7>: KP_1
<KP_8>: KP_2
<KP_9>: KP_3
<KP_1>: KP_7
<KP_2>: KP_8
<KP_3>: KP_9