Skip to content

Instantly share code, notes, and snippets.

View onjin's full-sized avatar

Marek Wywiał onjin

View GitHub Profile
@onjin
onjin / fb.css
Created August 2, 2017 08:26
usercss / fb
body, #contentCol {
background-color: #fff !important;
}
#blueBarDOMInspector > div > div {
background-color: orange;
border-bottom: 0px;
}
#pagelet_ego_pane,
#pagelet_canvas_nav_content,
#pagelet_ticker {
@onjin
onjin / postgres_queries_and_commands.sql
Created September 29, 2017 08:27 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@onjin
onjin / ponyc
Created January 10, 2018 10:00
bash script to run pony language compiler using docker
#!/bin/bash
# run pony compiller using docker
# requires realpath programm - apt-get install realpath
path=$(realpath "$@")
/usr/bin/docker run --rm -v ${path}:/src/main ponylang/ponyc
Every message has 3 ids, MessageId, CorrelationId, CausationId.
When you are responding to a message (either a command or an event)
you copy the CorrelationId of the message you are responding to to your message.
The CausationId of your message is the MessageId of the message you are responding to.
@onjin
onjin / digital_root.py
Created April 10, 2018 20:17
Calculate digital root with modulo arithmetic.
#!/usr/bin/env python
def root(n):
"""Calculate digital root with modulo arithmetic."""
return n % 9 or n and 9
if __name__ == "__main__":
for i in range(9):
@onjin
onjin / hints
Created June 27, 2018 22:01
display hints from devhints.io
#!/usr/bin/env bash
type wget >/dev/null 2>&1 || { echo >&2 "I require wget but it's not installed."; exit 1; }
type mdless >/dev/null 2>&1 || { echo >&2 "I require mdless but it's not installed. sudo gem install mdless"; exit 1; }
TOOL=${1:?Usage: $0 <toolname> [--refresh]}
REFRESH=${2:-no}
RAW_MD_URL="https://raw.github.com/hazeorid/devhints.io/gh-pages/${TOOL}.md"
<?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');
"""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.
#!/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) $*
# 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