Skip to content

Instantly share code, notes, and snippets.

View onjin's full-sized avatar

Marek Wywiał onjin

View GitHub Profile
@onjin
onjin / docker-compose.yml
Created August 17, 2016 06:33
onjin postgresql docker compose
postgresql92:
image: onjin/alpine-postgres:9.2
volumes:
- $HOME/.volumes/postgresql92:/var/lib/postgresql/data
postgresql93:
image: onjin/alpine-postgres:9.3
volumes:
# -*- coding: utf-8 -*-
"""Google Authenticator integration example
$ pip install otpauth qrcode pillow
"""
import qrcode
from otpauth import OtpAuth
@onjin
onjin / docker-compose.yml
Created September 5, 2016 09:17
example docker compose for postgresql with db init script
postgres:
image: postgres:9.4
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
NeoBundle 'chrisgillis/vim-bootstrap3-snippets'
NeoBundle 'vim-scripts/todo-txt.vim'
NeoBundle 'farseer90718/vim-taskwarrior'
NeoBundle 'vim-perl/vim-perl'
NeoBundle 'scrooloose/syntastic'
#!/bin/bash
# This script rotates the screen and touchscreen input 90 degrees each time it is called,
# by Ruben Barkow: https://gist.github.com/rubo77/daa262e0229f6e398766
#### configuration
# find your Touchscreen device with `xinput`
TouchscreenDevice='ELAN Touchscreen'
screenMatrix=$(xinput --list-props "$TouchscreenDevice" | awk '/Coordinate Transformation Matrix/{print $5$6$7$8$9$10$11$12$NF}')
#!/bin/bash
ID=$(xinput list|grep TouchPad|awk '{print $6}'| cut -d= -f 2)
STATE=$(xinput list-props ${ID} |grep 'Device Enabled'| awk '{ print $4}')
function do_enable() {
xinput enable ${ID}
killall notify-osd
notify-send 'TouchPad enabled'
}
START: [URL …or… mobile OS + app]
STEPS:
1. [list the exact steps it takes to reproduce the problem]
2. [use numbers to show each step in order]
3. [include multiple apps if necessary]
4. [write it so a 10 year old could reproduce]
ACTUAL: [identify the thing that is broken, screenshots help]
EXPECTED: [explain what you expected to see]
URGENCY: [only for critical production issue reports]
Example:
@onjin
onjin / specification.py
Created February 6, 2017 10:03 — forked from palankai/specification.py
Python Specification Pattern
class Specification:
def __and__(self, other):
return And(self, other)
def __or__(self, other):
return Or(self, other)
def __xor__(self, other):
return Xor(self, other)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import namedtuple
import requests
import logging
import json
import enum
class ApiInteraction(enum.Enum):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Simple json server.
echo '{"data": "some"}' > p1.json
python -m jsonserver
curl http://localhost:8000/p1
"""