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 / lsswap
Created October 14, 2011 22:37
really rough process list that includes swap and memory usage
#!/bin/bash
# print a ps listing that includes the used swap space
# inspired by Erik Ljungstrom 27/05/2011
maxwidth=$( stty -a | tr ';' '\n' | grep columns | awk '{ print $2 }' )
maxwidth=$(( maxwidth - 10 ))
pscols=vsz:10,rss:10,pid,user,pri,stime,time:12,cmd
paste <( echo SWAP ) <( ps -p $$ -o $pscols | head -1 )
for procdir in /proc/[0-9]* ; do
PID=$( basename $procdir )
@thwarted
thwarted / rinse.spec
Created November 29, 2011 09:47
RPM spec file for rinse
Name: rinse
Version: 1.9.1
Release: 0%{?dist}
Summary: Carry out the installation of a new RPM-based distribution.
Group: Development/Tools
License: Artistic
URL: http://www.steve.org.uk/Software/rinse/
Source: http://www.steve.org.uk/Software/rinse/rinse-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: make
@thwarted
thwarted / sublime_text.spec
Created September 5, 2012 07:22
spec file to package Sublime Text 2 (2.0.1 x86_64), since I hate installing stuff in my home dir
%define dlurl http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.1%20x64.tar.bz2
%define chksum bd816d93239a0af9ade257b2a9dcf8d2
%define version 2.0.1
Summary: Sublime Text 2
Name: sublime_text
Version: %{version}
Release: 1
License: Commerical
Group: Applications/Editors
@thwarted
thwarted / Custom.ccs
Created September 18, 2012 05:44
remove courier new as the forced font choice in gmail, use the user setting for monospaced font
/* force gmail fixed width font to NOT be courier
*/
div.gs font[face="courier new, monospace"] {
font-family: monospace !important;
}
/* this matches inside gmail's edit iframe
the CSS rule can not span documents inside iframes
*/
html body.editable font[face="courier new, monospace"] {
@thwarted
thwarted / libsyslogtostderr.c
Created December 17, 2012 08:53
lame attempt at redirecting syslog to stderr with LD_PRELOAD
#include <stdlib.h>
#include <stdarg.h>
void openlog(const char *ident, int option, int facility) {
return;
}
void syslog(int priority, const char *format, ...) {
va_list va;
va_start(va, format);
@thwarted
thwarted / plugins--Scout--config.py
Created March 25, 2013 22:59
Stupid and simple supybot plugin that does LDAP/AD lookups and returns phone and pager contact information. From Yelp! Hack-a-thon X, going for the "Useful" award.
###
# Copyright (c) 2013, Andy Bakun and Yelp!
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions, and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
@thwarted
thwarted / evrouter.spec
Created June 9, 2013 03:37
RPM spec file for evrouter
%define version 0.4
Summary: evrouter
Name: evrouter
Version: %{version}
Release: 1
License: GPL2
Group: Applications
URL: http://www.bedroomlan.org/projects/evrouter
Source: http://debian.bedroomlan.org/debian/pool/main/e/evrouter/evrouter_%{version}.tar.gz
@thwarted
thwarted / format-json-as-rss.php
Created June 18, 2013 07:13
Format some data as RSS that is currently only available as JSON
#!/usr/bin/php
<?php
date_default_timezone_set("GMT");
$type = "a type";
$key = "some identifier";
$json = "canonical url of this json stuff";
$entries = json_decode(file_get_contents("php://stdin"));
file { "/my/wrapper":
source => "puppet://...."
}
exec { "work-that-requires-key":
command => "ssh-agent /my/wrapper",
require => File["/my/wrapper"]
}
@thwarted
thwarted / git-crypt.spec
Created November 20, 2013 07:06
spec file for git-crypt
Summary: git-crypt git module
Name: git-crypt
Version: 0.3
Release: 1%{?dist}
License: GPL
Group: Development/Tools
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(id -un)-root
Source0: %{name}-%{version}.tar.bz2
Requires: openssl >= 0.9.8, pam, openssh-server, openssh
URL: https://www.agwa.name/projects/git-crypt/