Skip to content

Instantly share code, notes, and snippets.

View jollyroger's full-sized avatar

Andrii Senkovych jollyroger

  • TRData Limited
  • Ukraine
View GitHub Profile
@jollyroger
jollyroger / interfaces
Created October 24, 2009 07:42
Automatic Wi-Fi the Debian-way
auto wlan0
mapping wlan0
script /usr/local/sbin/wlan-detect.sh
map HomeAP wlan0-home
map OfficeAP wlan0-office
iface wlan0-home inet dhcp
wpa-ssid HomeAP
wpa-psk HomeAccessPointPassphrase
wpa-key-mgmt WPA-PSK
@jollyroger
jollyroger / fal.sh
Created December 9, 2009 21:50
"Fork, aggregate, log" script
#!/bin/bash
#
# NAME
# fal - wrapper script to run several concurrent commands and gather their
# output into one log file. fal is an abbreviation for "fork, aggregate, log"
#
# SYNOPSIS
# fal -c count [-l logfile] [-t] [-p pipe] [--] command [command_args]
#
# OPTIONS
@jollyroger
jollyroger / clean-ftp.sh
Created February 5, 2010 13:27
Cean incoming cronjob
#!/bin/sh
RMFILE_LOG=`mktemp`
RMFILE_ERR=`mktemp`
RMDIR_LOG=`mktemp`
RMDIR_ERR=`mktemp`
find ~ftp/incoming -mindepth 1 -mount -type f -atime +7 -exec rm -vf {} \; >$RMFILE_LOG 2>$RMFILE_ERR
find ~ftp/incoming -depth -mindepth 1 -mount -type d -empty -exec rmdir -v {} \; >$RMDIR_LOG 2>$RMDIR_ERR
echo "Cleaning FTP incoming directory:"
@jollyroger
jollyroger / fmetric.py
Created February 26, 2010 13:16
Help restore files from lost+found
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Script generates statistics table for specified direcories sorted by type(by
# default), overall files size or files count. This script can also sort files
# into the directories by type using hardlinks(default) or softlinks. Type
# determination is done by `file` utility.
#
# To get help just run script with wrong parameters.
import os
<script src="http://gist.github.com/324678.js?file=sample.html"></script>
@jollyroger
jollyroger / gist:502584
Created July 31, 2010 20:39
Demonstrates work of buildbot init script with two bots enabled
[jollyroger@gamma:buildbot-0.8.1]% sudo invoke-rc.d buildbot-master start [20:37:47]
Starting buildbot-master: twistd
Starting foo:done.
Starting bar:done.
[jollyroger@gamma:buildbot-0.8.1]% sudo invoke-rc.d buildbot-master reload [20:37:50]
Reloading buildbot-master: twistd
foo:done.
bar:done.
[jollyroger@gamma:buildbot-0.8.1]% sudo invoke-rc.d buildbot-master restart [20:37:54]
Restarting buildbot-master: twistd
@jollyroger
jollyroger / post-commit
Created December 22, 2010 16:05
Subversion post-commit hook for buildbot.
#!/bin/sh
# Subversion post-commit hook.
#
# This script will update files on the development web-server transparently
# without any files to be deleted before sync.
REV=$2
REPOS=$1
/usr/share/buildbot/contrib/svn_buildbot.py --repository "$REPOS" --revision "$REV" --bbserver 123.123.123.123 --bbport 9989
@jollyroger
jollyroger / rename_authors_in_svn.py
Created December 30, 2010 23:47
Rename authors in svn using svn dump file
#!/usr/bin/python
# -*- coding:utf8 -*-
import sys
authors = {
"author1_old_name\n":"author1_new_name",
"author2_old_name\n":"author2_new_name",
}
@jollyroger
jollyroger / apt.py
Created November 29, 2012 14:58
salt.states.debconf module
'''
Support for APT (Advanced Packaging Tool)
'''
# Import python libs
import os
import re
# Import Salt libs
import salt.utils
@jollyroger
jollyroger / ca.py
Created July 19, 2013 08:42
External pillar for populating hosts' private keys and certificates.
"""
Custom pillar module to retrieve certificates and private keys based on the
server id.
Configuring the CA ext_pillar
=============================
The CA ext_pillar configuration needs a path to the PKI directory and a Pillar
variable name to populate the data into. In the end ext_pillar configuration
will look like: