Skip to content

Instantly share code, notes, and snippets.

View lexruee's full-sized avatar
👻
tinkering

Alexander Rüedlinger lexruee

👻
tinkering
View GitHub Profile
//remove punctuation
System.out.println("3.5.".replaceAll("\\p{Punct}*$",""));
class Fixnum
def +(a)
self - a
end
end
@lexruee
lexruee / magnetic_sensor.py
Created March 6, 2015 23:02
detect door open/closed transition
#encoding: utf-8
"""
@author Alexander Rüedlinger <a.rueedlimger@gmail.com>
@date 06.03.2015
Simple program to detect transition of a door from closed state to open state
and vice versa using a magnetic sensor.
Magnetic sensor: http://www.adafruit.com/product/375
{
"@context": {
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"schema": "http://schema.org/",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"rdfs:subClassOf": {
"@type": "@id"
},
"name": "rdfs:label",
"description": "rdfs:comment",
{ "@context": {
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"owl": "http://www.w3.org/2002/07/owl#",
"express": "http://example.com/express#",
"defines": {
"@reverse": "rdfs:isDefinedBy"
},
"propertyOf": {
"@id": "rdfs:domain",
@lexruee
lexruee / gist:a095b9c3ecbf0aa8094b
Created April 7, 2015 22:04
fix gevent ssl issue in debian jessie
sudo apt-get install cython
git clone https://github.com/gevent/gevent
cd gevent
sudo python setup.py build
sudo python setup.py install
@lexruee
lexruee / ugly.java
Last active August 29, 2015 14:19
ugly code
public Variable lookupVariable(String id) {
/*
* A variable lookup can only occur inside a method or a class.
* Everything else is invalid.
*/
/*
* TODO: improve this hack!
*/
Variable variable;
Scopeable currentScope = this.currentScope();
@lexruee
lexruee / counter.py
Last active August 29, 2015 14:20
Counter example in Python
def a(x=[0]):
x.append(x[-1] + 1)
return x[-1]
print a()
print a()
print a()
def b(x=[0]):
@lexruee
lexruee / gist:c759bd2eab0cbfbce93c85b2287aea4e
Created July 16, 2017 17:29
schema snipped for disable suspend button
<key type="b" name="disable-suspend-button">
<default>false</default>
<summary>Disable suspend button</summary>
<description>Disable suspend button.</description>
</key>
@lexruee
lexruee / prefs part
Created July 16, 2017 17:33
disable suspend button feature
let disableSuspendButtonFrame = new AM.FrameBox();
let disableSuspendButtonRow = new AM.FrameBoxRow();
let disableSuspendButtonLabel = new Gtk.Label({
label: _("Disable activities hot corner"),
use_markup: true,
xalign: 0,
hexpand: true
});
let disableSuspendButtonSwitch = new Gtk.Switch({ halign: Gtk.Align.END });
disableSuspendButtonSwitch.set_active(this.settings.get_boolean('disable-suspend-button'));