Skip to content

Instantly share code, notes, and snippets.

@indrat
indrat / check-locations.py
Last active August 23, 2021 11:48
Compare check in history against ACT COVID19 Exposure locations - USE AT OWN RISK
#!/usr/bin/env python3
import argparse
import collections
import csv
import datetime
import io
import pathlib
import re
import sys
+------------------------------------------------------------------------------------------------------|
| HOST + DEVICES + COMMENTS/DESCRIPTION |
+------------------------------------------------------------------------------------------------------+
| 100 | NET | |
| | em1: 10.100.10.100 <-+ | LAN addr; bridged over 2 physical NICs |
| | docker0: 172.17.42.1 | | default docker bridge |
| | lo: 127.0.0.1 | | |
| +---> br0: 10.100.100.2 +--+ | bridge spanning 10.100.100.1/28, OSPF over L3 |
| | | | note that the first and last addresses are |
| | | | taken by the gateway.
@indrat
indrat / gist:d642dd92e268f73f944d
Last active August 29, 2015 14:02
execvp. why you no stat?
# While implementing fork-rate monitoring as per
# http://word.bitly.com/post/74839060954/ten-things-to-monitor
# we discovered that we had Perl processes that were making large numbers
# of execve syscalls. Investigating further it appears Perl uses execvp
# from glibc which results in an execve syscall for each entry in the path
# when using `backticks`, sytem or open(FH, "exe|") etc.
# Compare this to bash that appears to avoid execvp and instead iterates
# $PATH using stat and a single execve syscall.
## PERL ##
@indrat
indrat / gist:6359737
Last active December 21, 2015 20:09
consolidated steps to install an emoji font and to enable an ibus emoji keyboard input on unbuntu (raring 13.04). 1. install the symbola font 2. install UniEmoji ibus input 3. 💰 you may need to restart applications in order for them to start displaying emoji but once you do you too can enjoy emoji characters like: 💩
# install the Symbola font
sudo apt-get install ttf-ancient-fonts
# get the ibus emoji input source
git clone https://github.com/lalomartins/ibus-uniemoji.git
cd ibus-uniemoji
sudo make install
# enable the ibus emoji input
ibus-setup
@indrat
indrat / checkSuspend.sh
Created January 31, 2013 08:44
call out to dbus to suspend the computer if there are no samba shares active or ssh/ftp connections
#!/bin/bash
export DISPLAY=:0.0
source $(ls -rt ~/.dbus/session-bus/* | tail -1)
export DBUS_SESSION_BUS_ADDRESS
export XDG_SESSION_COOKIE=$(< ~/.xdg_cookie)
SS_ACTIVE_THRESHOLD=3600
SCREENSAVER_ACTIVE=$(qdbus org.gnome.ScreenSaver /ScreenSaver org.gnome.ScreenSaver.GetActiveTime)
@indrat
indrat / listIUs.sh
Created December 23, 2011 03:50
use the p2 director to list the installable units/features
#!/bin/bash
usage=`cat <<EOF
listIUs.sh <url>
e.g:
listIUs.sh http://download.scala-ide.org/nightly-update-master-2.8.0.final
EOF
`
if [[ -z $1 ]]; then
echo $usage
@indrat
indrat / installBundles.sh
Created December 23, 2011 03:49
run the p2 director to install features into a local eclipse
#!/bin/bash
# eclipse
repoUrls=http://download.eclipse.org/releases/indigo,http://download.eclipse.org/eclipse/updates/3.7,http://download.eclipse.org/eclipse/updates/3.6,http://download.eclipse.org/eclipse/updates/3.5,http://download.eclipse.org/eclipse/updates/3.4
repoUrls=$repoUrls,http://www.eclipse.org/modeling/emf/updates/,http://download.eclipse.org/modeling/emf/updates/releases/
repoUrls=$repoUrls,http://download.eclipse.org/birt/update-site/2.6
repoUrls=$repoUrls,http://download.eclipse.org/webtools/repository/indigo
repoUrls=$repoUrls,http://download.eclipse.org/tools/gef/updates/releases/
repoUrls=$repoUrls,http://download.eclipse.org/technology/dltk/updates
repoUrls=$repoUrls,http://download.eclipse.org/tools/cdt/releases/indigo
@indrat
indrat / mp3torss.py
Created November 12, 2011 21:56
scan a directory of mp3s and generate a rss feed of those mp3s based on Doug Hellmans m3utorss http://www.doughellmann.com/PyMOTW/fileinput/ http://pypi.python.org/pypi/m3utorss
#!/usr/bin/env python
# Copyright 2006 Doug Hellmann.
#
#
# All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee is hereby
# granted, provided that the above copyright notice appear in all