Skip to content

Instantly share code, notes, and snippets.

@mmb
mmb / pianobar_event_libnotify.rb
Created May 16, 2010 05:16
pianobar event script to create a libnotify notification when a song starts
#!/usr/bin/ruby
# pianobar event script to create a libnotify notification when a song starts
# Copyright (c) 2010
# Matthew M. Boedicker <matthewm@boedicker.org>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
@mmb
mmb / notify.py_skip_buffers_patch
Created May 17, 2010 03:04
patch to weechat notify.py script to allow skipping notifications for buffers by name
--- notify.py.orig 2010-05-18 19:45:52.000000000 -0400
+++ notify.py 2010-05-18 19:44:47.000000000 -0400
@@ -29,6 +29,7 @@
"icon" : "/usr/share/pixmaps/weechat.xpm",
"urgency" : "normal",
"smart_notification" : "off",
+ "skip_buffers" : "", # comma-separated list of buffers not to notify for
}
# Init everything
#!/usr/bin/ruby
# Apache log browser
require 'resolv'
line_re = %r{(.*?) (.*?) (.*?) \[(.*?) ([+-]\d{4})\] "(.*?) HTTP/[\d\.]+" (.*?) (.*?) "(.*?)" "(.*?)"}
ignore_ips = %w{
}
<?xml version="1.0" encoding="UTF-8"?>
<fuppes_config version="0.7.2.3">
<shared_objects>
<!--<dir>/mnt/music</dir>-->
<!--<itunes>/Users/.../iTunes.xml</itunes>-->
<dir>/home/mmb/media</dir>
<dir>/home/mmb/music</dir>
</shared_objects>
<network>
<!--empty = automatic detection-->
<?xml version="1.0" encoding="UTF-8"?>
<fuppes_vfolder_config version="0.2">
<vfolder_layout device="default" enabled="false">
<vfolder name="Genre">
<vfolders property="genre">
<items type="audioItem" />
</vfolders>
</vfolder>
require 'httparty'
class GoogleApi
include HTTParty
base_uri 'www.google.com/ig/api'
def self.weather(place)
get('', :query => { :weather => place })['xml_api_reply']['weather']
end
@mmb
mmb / pixelize.rb
Created January 11, 2011 03:35
convert image into retro 8-bit looking image
require 'RMagick'
# convert image intro retro 8-bit looking image
# http://matthewm.boedicker.org/
# find NES, SNES, etc. palette image on the web
palette = Magick::ImageList.new('/tmp/Palette_NTSC.png')
img = Magick::ImageList.new('/tmp/input.jpg')
@mmb
mmb / ufw_block_notify.rb
Created February 19, 2011 19:38
notify rbot of ufw blocks
#!/usr/bin/env ruby
# tail -f /var/log/messages | ufw_block_notify.rb
require 'resolv'
rbot_remote = '/home/mmb/src/rbot/bin/rbot-remote'
rbot_user = ''
rbot_password = ''
channel = ''
sudo apt-get install ufw
sudo ufw default deny
sudo ufw allow ssh/tcp
sudo ufw allow http
sudo ufw logging on
sudo ufw enable
sudo ufw status
@mmb
mmb / meme_generator.rb
Created March 17, 2011 03:55
Meme generator plugin for rbot
#++
#
# :title: Meme generator plugin for rbot.
#
# Author:: Matthew M. Boedicker <matthewm@boedicker.org>
#
# Copyright:: (c) 2011 Matthew M. Boedicker
#
# License:: MIT
#