Skip to content

Instantly share code, notes, and snippets.

piotr-dobrogost /
Created Jan 21, 2019 — forked from acdha/
Example of how to filter or apply custom formatting using Python's logging library
#!/usr/bin/env python
# encoding: utf-8
from pprint import pformat, pprint
import logging
class PasswordMaskingFilter(logging.Filter):
"""Demonstrate how to filter sensitive data:"""

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
piotr-dobrogost / dropbox
Created Oct 18, 2017 — forked from thisismitch/dropbox
Dropbox systemd and init files (CentOS 7)
View dropbox
# To configure, add line with DROPBOX_USERS="user1 user2" to /etc/sysconfig/dropbox
# Probably should use a dropbox group in /etc/groups instead.
# Source function library.
. /etc/rc.d/init.d/functions
piotr-dobrogost / mine
Created Jul 18, 2017
Set of scripts to manage ethereum miner ethminer.
View mine
export DISPLAY=:0
sudo nvidia-smi -pl 108
tmux \
set-option -g remain-on-exit on \; \
new-session -A -s ethminer "mining-oc && ethminer -SP 2 -U -S -O <address>:<miner>" \; \
split-window "mining-stats" \; \
piotr-dobrogost / tmux.cheat
Created Jun 28, 2017 — forked from afair/tmux.cheat
Tmux Quick Reference & Cheat sheet - 2 column format for less scrolling!
View tmux.cheat
========================================== ==========================================
========================================== ==========================================
List tmux ls List ^b w
New -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &
View Call stack while executing line 519 of (run for the first time ever, during app startup)
File "/opt/pycharm/pycharm-2016.1.2/helpers/pydev/", line 1531, in <module>
globals =['file'], None, None, is_module)
File "/opt/pycharm/pycharm-2016.1.2/helpers/pydev/", line 938, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/opt/pycharm/pycharm-2016.1.2/helpers/pycharm/", line 12, in <module>
File "/home/piotr/.virtualenvs/kotti/lib/python2.7/site-packages/pyramid/scripts/", line 60, in main
File "/home/piotr/.virtualenvs/kotti/lib/python2.7/site-packages/pyramid/scripts/", line 367, in run
View gist:225f9a4ac9a1a647b24698454dc7a48a
pip install packaging > /dev/null && python -c 'import sys,packaging.version; print(str(packaging.version.parse(sys.argv[1])))' '1.x.x'
piotr-dobrogost / \etc\openvpn\xxx.conf
Last active Mar 23, 2016
Starting OpenVPN directly vs as a service
View \etc\openvpn\xxx.conf
dev tun
proto udp
remote x.x.x.x 1194
remote y.y.y.y 1194
resolv-retry infinite
piotr-dobrogost / code
Last active Feb 23, 2016
SQLAlchemy AssertionError: Dependency rule tried to blank-out primary key column
View code
from sqlalchemy import create_engine
from sqlalchemy import Column, ForeignKey, Integer, String, Unicode, UniqueConstraint
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, sessionmaker
from sqlalchemy.orm.collections import attribute_mapped_collection
Base = declarative_base()
piotr-dobrogost /
Created Nov 6, 2015
Interaction between overrides and translations in Pyramid – difference with and without config.begin()
from pyramid.config import Configurator
config = Configurator()
config.override_asset('framework', 'app:framework-overrides/')