Skip to content

Instantly share code, notes, and snippets.

View asmaps's full-sized avatar

Arne Schauf asmaps

View GitHub Profile
import asyncio
from asyncirc import irc
bot = irc.connect("chat.freenode.net", 6667, use_ssl=False)
bot.register("NativeBot", "NativeBot", "NativeBot")
bot.join("#nativebot")
@bot.on("message")
def incoming_message(parsed, user, target, text):
@asmaps
asmaps / webhook.md
Last active December 7, 2015 17:09
MyAX Webhook example

When a new text is generated MyAX will send a HTTP POST request to the webhook URL. It has a signature header to verify the integrity/authenticity and some data about the object and the text in the post data body.

Signature header

HTTP_X_MYAX_SIGNATURE: "sha1=47d5b4154bc4161aaf4279d127f1a52d64895da1"

The checksum is calculated as hmac sha1 hexdigest. The key is your API token. The message is the post data.

@asmaps
asmaps / models.py
Last active March 8, 2016 19:30
Wagtail base page with common fields
from django.db import models
from wagtail.wagtailcore.models import Page
from wagtail.wagtailcore.fields import RichTextField
from wagtail.wagtailadmin.edit_handlers import FieldPanel, MultiFieldPanel
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
class BaseFieldsMixin(models.Model):
header_title = models.CharField(max_length=512, blank=True)
header_slogan = models.CharField(max_length=512, blank=True)
@asmaps
asmaps / gist:70fe605870a05352f546
Created August 5, 2015 08:54
whoami.filippo.io
asmaps@asmaps-x240 ~ % ssh whoami.filippo.io
+---------------------------------------------------------------------+
| |
| _o/ Hello Arne Schauf!
| |
| |
| Did you know that ssh sends all your public keys to any server |
| it tries to authenticate to? |
| |
Packets Pings
Host Loss% Snt Last Avg Best Wrst StDev
1. 10.42.2.1 0.0% 188 3.7 3.2 1.5 15.2 1.6
2. 192.168.100.2 0.0% 188 0.4 0.5 0.4 0.6 0.0
3. 217.5.98.13 51.9% 188 114.0 116.7 113.4 129.5 3.5
4. 217.237.152.62 63.1% 188 200.7 201.1 197.8 207.8 2.3
5. hh-ea7-i.HH.DE.NET.DTAG.DE 66.0% 188 198.8 200.1 197.4 206.0 1.8
6. 80.150.170.98 74.5% 188 198.3 199.1 197.3 222.1 3.6
7. 209.85.249.126 67.9% 188 198.6 202.0 196.9 255.7 11.3
8. 72.14.233.167 69.5% 188 197.6 198.6 197.1 205.4 1.2
@asmaps
asmaps / gist:a25d5dba88060dea955b
Created July 27, 2015 14:32
DTAG - läuft...
Packets Pings
Host Loss% Snt Last Avg Best Wrst StDev
1. 10.42.2.1 0.0% 29 1.8 2.8 1.8 5.4 0.9
2. 192.168.100.2 0.0% 29 0.6 0.5 0.4 0.6 0.0
3. 217.5.98.13 14.3% 29 96.3 101.5 95.7 150.1 10.8
4. 217.237.152.62 28.6% 29 161.4 166.3 161.4 174.9 3.4
5. hh-ea7-i.HH.DE.NET.DTAG.DE 25.0% 29 159.1 164.5 159.1 169.8 2.3
6. 80.150.170.98 48.3% 29 162.1 162.5 158.3 167.7 2.2
7. 209.85.249.124 28.6% 29 159.8 226.4 157.1 1439. 285.5
8. 72.14.233.216 39.3% 29 161.8 162.4 158.0 165.9 2.1
asmaps@asmaps-x240 ~/tmp % cat test.py
import requests
import json
r = requests.get(
'https://s3-eu-west-1.amazonaws.com/uploads-eu.hipchat.com/81297/1708406/kh8jkvVIW8FnZeU/synonymdb.json')
d = json.loads(r.content)
for key, value in d.iteritems():
asmaps@asmaps-x240 ~/tmp % cat test.py
d = {
'bla': [['a', 'b', 'bla', 'c'], ['d', 'e', 'bla']],
'foo': [['a', 'b', 'foo', 'c'], ['d', 'e', 'foo']],
}
for key, value in d.iteritems():
for l in value:
l.remove(key)
@asmaps
asmaps / gist:7603e51a73f04dc56c8d
Created January 14, 2015 13:00
sync_to_s3_with_boto.py
#! /usr/bin/env python
# coding=utf-8
import os
import sys
import boto
import boto.s3
from boto.s3.key import Key
@asmaps
asmaps / gist:fb8cb97675e7aef6bcde
Created July 26, 2014 10:36
/usr/share/X11/xorg.conf.d/52-custom-synaptics.conf
Section "InputClass"
Identifier "touchpad catchall"
Driver "synaptics"
MatchIsTouchpad "on"
# disable synaptics driver pointer acceleration
Option "MinSpeed" "1"
Option "MaxSpeed" "20"
# tweak the X-server pointer acceleration
Option "AccelerationProfile" "2"
Option "AdaptiveDeceleration" "10"