Skip to content

Instantly share code, notes, and snippets.

@mmb
mmb / emacs_scratch_paste
Created August 9, 2012 21:47
paste contents of clipboard to emacs scratch buffer
# paste contents of clipboard to emacs scratch buffer
tell application "Emacs"
activate
tell application "System Events"
keystroke "x" using {control down}
keystroke "b*scratch*"
keystroke return
keystroke ">" using {option down}
keystroke return
@mmb
mmb / leaving_work_notify.lua
Created July 2, 2012 23:28
SL4A Lua script to send SMS from Llama
-- SL4A Lua script to send SMS from Llama
-- Llama action is "Run App Shortcut" / Scripts
require "android"
android.smsSend("3155551212", "I have left work")
@mmb
mmb / tweet_meme.rb
Created April 27, 2012 02:09
turn tweets into images
#!/usr/bin/env ruby
require 'RMagick'
require 'meme_captain'
require 'open-uri'
require 'twitter'
tweet = Twitter.status(ARGV[0])
img = Magick::Image::read(tweet.user.profile_background_image_url)[0]
@mmb
mmb / gist:2362460
Created April 11, 2012 20:47
configuring networking in Windows with a script
# configuring networking in Windows with a script
# set interface to dhcp
netsh interface ip set address name="Local Area Connection" dhcp
netsh interface ip set dns "Local Area Connection" dhcp
# set static ip on interface
netsh interface ip set address name="Local Area Connection" static 192.168.0.2 255.255.255.0 192.168.0.1 1
netsh interface ip set dns "Local Area Connection" static 8.8.8.8
netsh interface ip add dns "Local Area Connection" 8.8.4.4 index=2
Method fromStringMethod;
for (Method m : port.getClass().getMethods()) {
if (m.getName().equals("setwisite_sessionreliability")) {
System.out.println(m.getName());
for (Class<?> c : m.getParameterTypes()) {
try {
fromStringMethod = c.getMethod("fromString",
new Class<?>[] { String.class });
} catch (Exception e) {
@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
#
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 / 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 = ''
@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')
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