Skip to content

Instantly share code, notes, and snippets.

View mrjk's full-sized avatar

mrjk

  • Montréal
View GitHub Profile
@mrjk
mrjk / pgprepmgr.sh
Last active October 16, 2015 21:12 — forked from dansimau/pgprepmgr.sh
Wrapper for pgpools' pcp tools to help you manage your pgpool setup and postgresql cluster. See usage in the comment below.
#!/bin/bash
#
# pgpool-II replication manager
#
# Interfaces with pgpool's pcp command-line tools to provide access to common functions for managing
# load-balancing and failover.
#
# mrjk.78 at the famous google mail
# 2014-10-13
# [email protected]
@mrjk
mrjk / keybase.md
Created May 24, 2017 04:06
Keybase proof

Keybase proof

I hereby claim:

  • I am mrjk on github.
  • I am mrjk (https://keybase.io/mrjk) on keybase.
  • I have a public key whose fingerprint is 6684 1AF5 79E5 D08F FE31 0636 AE08 F1AE E051 5AEC

To claim this, I am signing this object:

@mrjk
mrjk / streamit.rb
Created November 23, 2020 04:34 — forked from trisweb/streamit.rb
Script to run an esound stream from soundflower to a pulseaudio server
#!/usr/bin/env ruby
# Requirements:
# - A PulseAudio server running at the host in TO below.
# - SoundFlower installed
# - ESound installed (on mac, brew install esound)
# Select SoundFlower (2ch) as both Input AND Output devices, then run "streamit start"
# otherwise you don't have to worry about anything; it's a daemon, will run in the background,
# once you're finished just kill esd or run "streamit stop"
@mrjk
mrjk / cli-app-argparse-multilevel.py
Last active February 6, 2025 17:23
POC on how to do argparse multilevel CLIs [python] (Archive)
#!/usr/bin/python3
# Migrated to: https://github.com/mrjk/python_snippets/blob/main/examples/argparse/cli-app-argparse-multilevel.py
# Source: https://stackoverflow.com/questions/11760578/argparse-arguments-nesting
import argparse
parser = argparse.ArgumentParser(description='Deployment tool')
subparsers = parser.add_subparsers()
@mrjk
mrjk / cli-app-argparse.py
Last active February 6, 2025 17:23
Object oriented python command line with some examples (Archive)
#!/usr/bin/env python3
# Migrated to: https://github.com/mrjk/python_snippets/blob/main/examples/argparse/cli-app-argparse.py
# Run like this:
# python3 python_cli.py -vvvv demo
# Author: mrjk
import os
import sys
@mrjk
mrjk / bash_lib_utils.sh
Last active December 31, 2023 02:25
Bash library utils
yaml2json ()
{
python -c 'import yaml, json, sys ; print(json.dumps(yaml.safe_load(sys.stdin.read())))'
}
json2yaml ()
{
python -c 'import yaml, json, sys; print(yaml.dump(yaml.safe_load(sys.stdin.read()), indent=2))' input.yaml
}
@mrjk
mrjk / slack_notify.py
Last active February 6, 2025 17:22
Portable python script to send Slack notifications (Archive)
#!/usr/bin/python3
#
# Migrated to: https://github.com/mrjk/python_components/blob/main/helpers/slack_notify.py
#
# Documentation
# =============================
#
# This little script to easily send slack notifications.
# Tiger's team webhooks are configured here: https://XXX.slack.com/apps/YYY-incoming-webhooks
#
@mrjk
mrjk / libvirt-hook-wrapper.sh
Created May 13, 2021 21:36
A generic shell hook handler for libvirt
#!/bin/bash
#
# Libvirt Hook Wrapper
# =========================
# Little tool to manage libivrt hooks in an easy way.
#
# Documentation:
# ---------------
# - https://libvirt.org/hooks.html
#
@mrjk
mrjk / disks_infos.sh
Created July 11, 2021 19:15
A little script to get disks informations
#!/bin/bash
# Tooling: Debian
# apt install smartmontools sysstat hdparm
# Sata infos
# SATA revision 1.0 => 1.5 Gbit/s, 150 MB/s
# SATA revision 2.0 => 3 Gbit/s, 300 MB/s
# SATA revision 3.0 => 6 Gbit/s, 600 MB/s
# SATA revision 3.2 => 16 Gbit/s, 1969 MB/s
@mrjk
mrjk / run_iodine_client.sh
Created September 16, 2021 12:01
Iodine Scripts
#!/bin/bash
# Author: https://gist.github.com/mrjk/
# License: MIT
IODINE_PASS=mypass
IODINE_DOMAIN=t.mydomain.org
IODINE_GW=10.18.0.1
IODINE_FORWARD=true
IODINE_SERVER=w.x.y.z