Skip to content

Instantly share code, notes, and snippets.

Marek Wywiał onjin

Block or report user

Report or block onjin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@onjin
onjin / feature-toggles-memo.md
Last active Aug 29, 2019
Categories of feature toggles
View feature-toggles-memo.md

Feature toggles types

Short memo from:

Release Toggles

For not finished / not tested features

  • Configuration type: static - per environment, f.i. enabled only on test/stage
  • Lifetime: Short - until feature is finished / tested
View the-discipline-of-finishing.md
@onjin
onjin / python_code_profiling.md
Last active Mar 6, 2019
python code profiling
View python_code_profiling.md

requirements

Install https://github.com/jrfonseca/gprof2dot

Run profiler

$ python -m cProfile -o profiler.pstats ./some/python/code.py
$ gprof2dot -f pstats profiler.pstats | dot -Tpng -o profiler.png  # generate PNG calltree image
$ pyprof2calltree -i profiler.pstats -k  # debug with kcachegrind
@onjin
onjin / modularity.md
Last active Dec 6, 2018
software modularity
View modularity.md
@onjin
onjin / tests_responsibilities.md
Last active Feb 12, 2019
tests responsibilities
View tests_responsibilities.md
@onjin
onjin / nju-cli.py
Created Nov 21, 2018
example of writing cli program
View nju-cli.py
#!/usr/bin/env python
import argparse
import getpass
import sys
from contextlib import contextmanager
from distutils.util import strtobool
def yes_or_no(question, default='no'):
"""Ask question and wait for yes/no answer.
View .tmux.conf
# Rebind prefix key
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# Pretty colors
# set -g status-bg blue
# set -g status-fg white
# Bindings
View freemind.sh
#!/bin/bash
xhost +
docker run \
--rm \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $(pwd)/:/data/ \
-ti eferro/freemind /freemind.sh $(id -u) $*
View sigusr1_debug.py
"""Start interactive console on SIGUSR1 signal.
run:
$ python ./sigusr1_debug.py
and in another window
$ ps aux|grep sigusr1_debug
$ kill -10 [process pid]
and in first window you get:
.
Signal received : entering python shell.
View wpinstall.php
<?php
file_put_contents('latest.zip', fopen('https://wordpress.org/latest.zip', 'r'));
system('unzip ./latest.zip');
system('rm ./latest.zip');
system('mv wordpress/* .');
system('rmdir wordpress');
You can’t perform that action at this time.