Skip to content

Instantly share code, notes, and snippets.

View alexforrow's full-sized avatar

Alex Forrow alexforrow

View GitHub Profile
@alexforrow
alexforrow / tv_watch_host
Last active August 29, 2015 13:58
Control HDMI on Raspberry Pi based on presence of network host
#!/bin/bash
# Switch HDMI on/off depending on presence of network host
if [ -z "$1" ]; then
echo "Usage: $0 hostname"
exit 1
fi
(
@alexforrow
alexforrow / gist:8847703
Created February 6, 2014 16:30
Dirty datanode status collection via page-scrape
#!/bin/bash
. /etc/metric.sh
(
flock -n 200
if [ ! $? -eq 0 ]; then
echo Already running
exit 1
fi
@alexforrow
alexforrow / gist:3061316
Created July 6, 2012 16:58
libmemcached TCP timeout > 1sec causes assertion failure
#include <libmemcached/memcached.hpp>
using namespace memcache;
int main() {
const char *config_string= "--SND-TIMEOUT=1000000 --SERVER=localhost:2034";
memcached_st *memc= memcached(config_string, strlen(config_string));
memcached_free(memc);
}
@alexforrow
alexforrow / gist:2912962
Created June 11, 2012 21:49
Efergy elink portmon
0 0.04593154 Elink.exe IRP_MJ_CREATE VCP0 SUCCESS Options: Open
1 0.00000475 Elink.exe IOCTL_SERIAL_GET_PROPERTIES VCP0 SUCCESS
2 0.00000335 Elink.exe IOCTL_SERIAL_GET_MODEMSTATUS VCP0 SUCCESS
3 0.00000307 Elink.exe IOCTL_SERIAL_GET_BAUD_RATE VCP0 SUCCESS
4 0.00000279 Elink.exe IOCTL_SERIAL_GET_LINE_CONTROL VCP0 SUCCESS
5 0.00000223 Elink.exe IOCTL_SERIAL_GET_CHARS VCP0 SUCCESS
6 0.00000279 Elink.exe IOCTL_SERIAL_GET_HANDFLOW VCP0 SUCCESS
7 0.00000279 Elink.exe IOCTL_SERIAL_GET_BAUD_RATE VCP0 SUCCESS
8 0.00000251 Elink.exe IOCTL_SERIAL_GET_LINE_CONTROL VCP0 SUCCESS
@alexforrow
alexforrow / chef_php_update_notify.rb
Created June 27, 2011 15:07
Letting devs know when Chef updates PHP
# Email system contact when PHP is updated
execute "php_update_email" do
command "echo Contact operations for details | mail -s 'PHP has been updated on #{node[:hostname]}' #{node[:contact]}"
action :nothing
end
# Ensure latest PHP
package "php53" do
action :upgrade
notifies :run, resources(:execute => "php_update_email")
@alexforrow
alexforrow / spotify_pp
Created May 9, 2011 12:11
Spotify for Linux keyboard buttons
#!/bin/bash
# Install
# Place in ~/bin
# sudo aptitude install xwit xvkbd wmctrl
if [ "x$1" == "x" ];then
command=" "
else
command=$1
@alexforrow
alexforrow / gist:659609
Created November 2, 2010 13:32
Use of search for template
nodes = search(:node, "*:*")
template "/etc/ssh/ssh_known_hosts" do
source "ssh_known_hosts.erb"
mode 0644
owner "root"
group "root"
variables(:nodes => nodes)
end
[root@coot yum.repos.d]# chef-client
[Thu, 19 Aug 2010 11:07:53 +0100] INFO: Starting Chef Run
/usr/lib/ruby/gems/1.8/gems/moneta-0.6.0/lib/moneta/basic_file.rb:53:in `load': marshal data too short (ArgumentError)
from /usr/lib/ruby/gems/1.8/gems/moneta-0.6.0/lib/moneta/basic_file.rb:53:in `raw_get'
from /usr/lib/ruby/gems/1.8/gems/moneta-0.6.0/lib/moneta/basic_file.rb:41:in `[]'
from /usr/lib/ruby/gems/1.8/gems/moneta-0.6.0/lib/moneta/../moneta.rb:69:in `fetch'
from /usr/lib/ruby/gems/1.8/gems/chef-0.8.16/bin/../lib/chef/cache/checksum.rb:38:in `lookup_checksum'
from /usr/lib/ruby/gems/1.8/gems/chef-0.8.16/bin/../lib/chef/cache/checksum.rb:34:in `checksum_for_file'
from /usr/lib/ruby/gems/1.8/gems/chef-0.8.16/bin/../lib/chef/cache/checksum.rb:28:in `checksum_for_file'
from /usr/lib/ruby/gems/1.8/gems/chef-0.8.16/bin/../lib/chef/mixin/checksum.rb:27:in `checksum'