Skip to content

Instantly share code, notes, and snippets.

View onjin's full-sized avatar

Marek Wywiał onjin

View GitHub Profile
#!/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'
}
#!/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}')
NeoBundle 'chrisgillis/vim-bootstrap3-snippets'
NeoBundle 'vim-scripts/todo-txt.vim'
NeoBundle 'farseer90718/vim-taskwarrior'
NeoBundle 'vim-perl/vim-perl'
NeoBundle 'scrooloose/syntastic'
@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
# -*- coding: utf-8 -*-
"""Google Authenticator integration example
$ pip install otpauth qrcode pillow
"""
import qrcode
from otpauth import OtpAuth
@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:
@onjin
onjin / secrets.py
Created August 4, 2016 07:43
python 3.6 secrets module
"""Generate cryptographically strong pseudo-random numbers suitable for
managing secrets such as account authentication, tokens, and similar.
See PEP 506 for more information.
https://www.python.org/dev/peps/pep-0506/
"""
__all__ = ['choice', 'randbelow', 'randbits', 'SystemRandom',
'token_bytes', 'token_hex', 'token_urlsafe',
@onjin
onjin / _core.py
Created July 21, 2016 06:33 — forked from justanr/_core.py
Clean Architecture In Python
from abc import ABC, ABCMeta, abstractmethod
from collections import namedtuple
from itertools import count
PayloadFactory = namedtuple('PayloadFactory', [
'good', 'created', 'queued', 'unchanged', 'requires_auth',
'permission_denied', 'not_found', 'invalid', 'error'
])
"""
@onjin
onjin / money.py
Created July 20, 2016 11:43 — forked from justanr/money.py
Example of a small value object representing money.
import decimal
from functools import total_ordering
from numbers import Real
class Context(object):
def __init__(self, **kwargs):
self.context = decimal.Context(**kwargs)
def __enter__(self):
with decimal.localcontext(self.context) as c:
@onjin
onjin / list_all_nginx_virtual_hosts.sh
Created February 23, 2016 08:06
list all running nginx virtual hosts on docker created using https://github.com/jwilder/nginx-proxy
# list all running nginx virtual hosts on docker created using
# `https://github.com/jwilder/nginx-proxy`
docker inspect --format '{{ index (index .Config.Env) 1 }}' $(docker ps -q) | grep VIRTUAL_HOST | cut -d\= -f 2