Skip to content

Instantly share code, notes, and snippets.

@fayak
fayak / error_handling.sh
Last active August 8, 2024 16:29
Error handling in bash with sentry support
#!/usr/bin/env bash
set -eTEuo pipefail
function get_pgid() {
cut -d " " -f 5 < "/proc/$$/stat" | tr ' ' '\n'
}
pgid="$(get_pgid)"
if [[ "$$" != "$pgid" ]]; then
@fayak
fayak / docker-pruner.sh
Last active November 7, 2024 10:40
Docker pruner. Deletes docker's overlay2 leftovers that survive 'docker system prune -af --volumes'
#!/usr/bin/env bash
set -eEuo pipefail
MARKER_FILE_NAME="${DOCKER_PRUNER_MARKER:-DOCKER-PRUNER-MARKER-FILE}"
DOCKER_PATH="${DOCKER_PATH:-/var/lib/docker/overlay2}"
function _used_dirs() {
for docker_obj in $(docker ps -aq) $(docker image ls -aq); do
lowerdir="$(docker inspect "$docker_obj" | jq '.[].GraphDriver.Data.LowerDir' -r)"
@fayak
fayak / .Xresources
Created September 28, 2020 20:40
Dotfiles
xterm*background: rgb:15/15/19
xterm*foreground: white
XTerm*locale: true
xterm*VT100.Translations: #override \
Ctrl Shift <Key>V: insert-selection(CLIPBOARD) \n\
Ctrl Shift <Key>C: copy-selection(CLIPBOARD)
@fayak
fayak / stats.py
Created May 13, 2020 17:11
Get more frequent french city "name" as mapcustomizer.com visualizable data
#!/usr/bin/env python3
# Based on https://public.opendatasoft.com/explore/dataset/correspondance-code-insee-code-postal/download/?format=json&timezone=Europe/Berlin&lang=fr
# The JSON file must be argv[1]
import json
import sys
class City():
token_stats = {}
#!/usr/bin/env python3
#config.py
import json
from elasticsearch import Elasticsearch
es = Elasticsearch(
["127.0.0.1"],
http_auth=None, # http_auth=('user', 'secret')
scheme="http",
@fayak
fayak / IngressDualMap.user.js
Last active January 24, 2017 11:43 — forked from Terrance/IngressDualMap.user.js
An IITC plugin that exports portals currently in view as a CSV list for use with Ingress Dual Map.
// ==UserScript==
// @id iitc-plugin-ingressdataextract@LeCoon
// @name IITC plugin: Ingress Data Extractor
// @category Keys
// @version 0.0.0.1
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @description Data Extractor
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://www.ingress.com/intel*