Skip to content

Instantly share code, notes, and snippets.

@fpytloun
fpytloun / alarm.sh
Last active February 13, 2016 16:09
Simple desktop notifications from cli
#!/bin/bash
#
# Simply make some noise to notify user
# Usage:
# alarm.sh [message]
# echo alarm.sh | at 15:30
#
## Required variables
export DISPLAY=${DISPLAY:-":0.0"}
@fpytloun
fpytloun / venv.sh
Last active May 28, 2016 09:22
Simple Python virtualenv wrapper
#!/bin/bash
VENV_HOME=${VENV_HOME:-$HOME/virtualenv}
SHELL=${SHELL:-/bin/zsh}
exit_err() {
echo "[ERROR] $1" 1>&2
exit 1
}
@fpytloun
fpytloun / glustertop.py
Last active August 21, 2022 14:11
Real time GlusterFS top-like monitoring
#!/usr/bin/env python3
"""
Display gluster traffic
This tool uses gluster profiling feature, parsing cumulative statistics.
To understand correctly the results, you have to divide overall write statistics with number of replicas.
Also striped volumes needs to be taken in mind - overall statistics just print sum of all bricks
read/written bytes.
@fpytloun
fpytloun / clexec.py
Last active October 20, 2021 12:22
Cluster execution tool
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Tool for commands execution over clusters
"""
import os, sys, logging, urllib
import argparse
import threading
@fpytloun
fpytloun / venv.sh
Last active May 18, 2016 08:38
Simple virtualenv manager
#!/bin/bash
VENV_HOME=${VENV_HOME:-$HOME/virtualenv}
SHELL=${SHELL:-/bin/zsh}
exit_err() {
echo "[ERROR] $1" 1>&2
exit 1
}
@fpytloun
fpytloun / init.vim
Last active February 10, 2020 11:42
Neovim config
""" Common behavior
" Theme and colors
let base16colorspace=256
set background=dark
" Disable stupid backup and swap files - they trigger too many events for file
" system watchers
set nobackup
set nowritebackup
set noswapfile
# this is your configuration file for pbuilder.
# the file in /usr/share/pbuilder/pbuilderrc is the default template.
# /etc/pbuilderrc is the one meant for overwriting defaults in
# the default template
#
# read pbuilderrc.5 document for notes on specific options.
APTCACHE="/car/cache/pbuilder/aptcache"
USENETWORK="no"
HOOKDIR="/etc/pbuilder/hooks"
@fpytloun
fpytloun / gdebuild.sh
Last active October 19, 2017 11:14
Cowbuilder/git-buildpackage wrapper
#!/bin/bash -e
#
# Put something like this into /etc/sudoers:
# Defaults env_reset,env_keep+="DEB* DIST ARCH ADT OS"
# Cmnd_Alias PBUILDER = /usr/sbin/pbuilder, /usr/bin/pdebuild, /usr/bin/debuild-pbuilder, /usr/sbin/cowbuilder, /usr/sbin/chroot, /usr/bin/git-buildpackage
# @adm ALL=(root) NOPASSWD: PBUILDER
#
[ -z "$DEBUG" ] || set -x
@fpytloun
fpytloun / lenovo_kbd.sh
Created July 28, 2016 08:25
Setup Lenovo USB keyboard
#!/bin/bash
#
# Setup Lenovo USB keyboard with trackpoint
# Systemd users:
# /etc/udev/rules.d/99-lenovo-kbd.rules:
# ACTION=="add", ATTR{idVendor}=="17ef", ATTR{idProduct}=="6047", TAG+="systemd", ENV{SYSTEMD_WANTS}="udev-lenovo-kbd-attach.service"
# /etc/systemd/system/udev-lenovo-kbd-attach.service:
# [Service]
# Type=oneshot
# ExecStart=/usr/local/bin/lenovo_kbd.sh
@fpytloun
fpytloun / C10shell
Created August 4, 2016 15:02
pbuilder hook to access shell on FTBFS
#!/bin/bash
# example file to be used with --hookdir
#
# invoke shell if build fails.
echo "=== BUILD FAILED"
read -r -p "=== Do you want to enter shell and investigate situation? (Y/n) " res < /dev/tty > /dev/tty 2> /dev/tty
if [[ ${res,,} =~ ^(yes|y|)$ ]]; then
BUILDDIR="${BUILDDIR:-/tmp/buildd}"
apt-get install -y "${APTGETOPT[@]}" vim-nox less