Skip to content

Instantly share code, notes, and snippets.

View thwarted's full-sized avatar
🥓
increasingly at large

Andy Bakun thwarted

🥓
increasingly at large
View GitHub Profile
@thwarted
thwarted / notify-agent-use
Last active August 29, 2015 14:00
notify on ssh-agent use
#!/bin/bash
countfile=/tmp/agentcount.${USER}.$( date +%Y%m%d )
c=$( cat "$countfile" 2>/dev/null )
c=$(( c + 1 ))
echo $c > "$countfile"
msg="${*/Allow use of/Using}"
msg="$( echo "${msg/\?/}" | fold -w 34 )"
@thwarted
thwarted / pause
Created May 13, 2014 05:59
pause
#include <unistd.h>
void main() { pause(); }
@thwarted
thwarted / build-the-gems-i-need
Last active August 29, 2015 14:01
/usr/lib64/ruby/gems/2.1.0/gems/gem2rpm-0.10.1/templates/fedora.spec.erb that works better with ruby-2.1
#!/bin/bash
set -x
cd ~/rpmbuild/SOURCES
function doit() {
local gemname="$1"
gem2rpm --fetch $gemname --output ../SPECS/rubygem-$gemname.spec
@thwarted
thwarted / resize-java-iKVM-viewer
Last active June 3, 2025 06:58
resize-java-iKVM-viewer: find all supermicro Java iKVM Viewer windows and resize them to display all the content
#!/bin/bash
# find all supermicro Java iKVM Viewer windows and resize
# them to display all the content
#
# for reasons that are beyond sanity, this shitty closed source program
# sets the min and max window sizes to the same values, making it unresizable
# through dragging.
# this wouldn't be so bad if it actually resized the window to display all
# the content. it constantly resizes based on the resolution of the
@thwarted
thwarted / keybase.md
Created August 13, 2014 21:59
keybase.md

Keybase proof

I hereby claim:

  • I am thwarted on github.
  • I am thwarted (https://keybase.io/thwarted) on keybase.
  • I have a public key whose fingerprint is 8CC0 42B3 3D0A CE55 5BA8 7623 0317 C210 0A72 3223

To claim this, I am signing this object:

@thwarted
thwarted / syslog-ng.statsd.conf
Last active August 29, 2015 14:05
increment graphite metrics via statsd from matched syslog lines using syslog-ng
# vim:ft=syslog-ng:ai:si:ts=4:sw=4:et:expandtab
# assumes RFC5424 format and a SD-ELEMENT "x-service" in the SD-ID "origin"
# customize to taste
@define statdprefix "service.${.SDATA.origin.x-service}."
# send your log data to port 8888
source s_logdata {
udp(port(8888) flags(syslog-protocol) tags("logdata"));
@thwarted
thwarted / FOR_EACH.cmacros.h
Created September 17, 2014 00:17
a FOR_EACH C Preprocessor macro that works under both GNU CC and Visual Studio 2013/MSVC
/* all this verbosity is required for this to work reliably and predictably
* on both GCC and MSVC
*/
/* because gcc cpp doesn't recursively expand macros, so a single CALLIT
* macro can't be used in all the FE_n macros below
*/
#define FE_CALLITn01(a,b) a b
#define FE_CALLITn02(a,b) a b
@thwarted
thwarted / transmission.initd
Created September 19, 2014 17:23
control script for transmission; you'll need to roll your own settings.json
#!/bin/bash
TRHOME=$( readlink -f $( dirname $0 ) )
# mkdir -p complete config incomplete logs torrents
PIDFILE=$TRHOME/logs/transmission.pid
dostart() {
cd $TRHOME
transmission-daemon \
--config-dir $TRHOME/config \
@thwarted
thwarted / pipe-to-dgram
Created November 19, 2014 05:38
pipe-to-dgram
#!/bin/bash
exec 3> >( while /bin/true ; do socat -t0 -T0 -u STDIN UDP:172.28.128.3:8888 ; done )
while /bin/true; do
while read line; do
echo "$line"
echo "$line" >&3
sleep 0.1
done < /vagrant/testlog
done
@thwarted
thwarted / portserve
Created November 19, 2014 05:39
portserve - simple script used to test haproxy healthcheck settings
#!/bin/bash
if [[ "$2" ]]; then
msg="serving port $1"
size=$( echo "$msg" | wc -c )
read request
while /bin/true; do
read x
if [[ "$x" == "" ]]; then
break