Skip to content

Instantly share code, notes, and snippets.

View matthewryanscott's full-sized avatar

Matthew R. Scott matthewryanscott

View GitHub Profile
class Plantuml < SimpleDelegator
end
module IRuby
module Display
module Registry
type { Plantuml }
format 'image/svg+xml' do |obj|
Tempfile.open('uml') do |uml|
uml.write(obj)
{% if 'servmon' in grains['roles'] %}
f2bpath: /var/log/httpd/error_log
{% elif 'webserver' in grains['roles'] %}
f2bpath: /home/*/log/error_log
{% endif %}
ufw:
pkg.installed
enable ufw:
cmd.run:
- name: ufw enable
- require:
- pkg: ufw
enable ssh:
@matthewryanscott
matthewryanscott / creating_functions.py
Created March 5, 2013 23:17
Programmatically creating functions
# This could be called a "function factory".
# It is a function that creates, then returns, new functions.
def generic_site_fn(url_template):
# Define an inner function ...
def generic_site_submit(url):
generic_site_url = url_template.format(url=url)
requests.get(generic_site_url)
# ... that is returned by the factory function.
return generic_site_submit
@matthewryanscott
matthewryanscott / gist:3947224
Created October 24, 2012 16:40
Use of functools.partial instead of using a closure
from functools import partial
def tracecalls(cls):
def my__getattribute__(self, name):
attr = super(cls, self).__getattribute__(name)
return attr if not callable(attr) else partial(whencalled, attr)
cls.__getattribute__ = my__getattribute__
@matthewryanscott
matthewryanscott / uninitialized.enaml
Created June 30, 2012 03:08
Component uninitialized; attr changes do not propagate as expected
# System:
# OSX 10.7.4
# Qt 4.8.0
# PySide 1.1.1
from enaml.stdlib.radio_group import RadioGroup
DEFAULT_TRIGGER_METHOD_NAME = 'request_refresh_task'
@matthewryanscott
matthewryanscott / gist:2913909
Created June 12, 2012 01:50
Installing retroshare on Debian Squeeze
This is what worked for me to install it on Squeeze 64-bit:
$ sudo aptitude install libqt4-dev g++ libgpgme11-dev libgpg-error-dev libupnp-dev libssl-dev libgnome-keyring-dev libxss-dev gnupg-agent
If this asks you to remove packages, DO NOT CONTINUE. The above line should only INSTALL packages. Fix your system first.
$ wget http://sourceforge.net/projects/retroshare/files/RetroShare/0.5.3c/RetroShare-v0.5.3c.tar.gz/download
$ tar xzvf RetroShare-v0.5.3c.tar.gz
$ cd trunk/libbitdht/src
$ qmake && make
@matthewryanscott
matthewryanscott / gist:2788909
Created May 25, 2012 15:53
https://my.webfaction.com/make-payment source - locks up on Chrome version 21.0.1150.3 (Official Build 138970) canary
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>WebFaction Control Panel</title>
<meta name="description" content="The WebFaction control panel. This site allows WebFaction customers to manage their accounts and websites." />
<link href="https://my.webfaction.com/media/css/screen.r1337180865.css" rel="stylesheet" type="text/css" />
@matthewryanscott
matthewryanscott / FindPanelLayoutAppDelegate.m
Created May 22, 2012 23:08
enaml constraints vs Cocoa Auto Layout
/*
File: FindPanelLayoutAppDelegate.m
Abstract: Creates interface elements and lays out the window
Version: 1.2
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
@matthewryanscott
matthewryanscott / FUCKCIT.PIE.c
Created May 15, 2012 15:28
FuckCitPie general release version 5.12
/*
95Apr17 From golden spud @ Golden Spud's Greasehouse, matt.org
Also,
BRENT. After you left the "not-together", DP, scorpio, and I wrote a Citadel
in less than 30 minutes on FRuG's computer, in Borland C++.
We aptly named it FuckCitPie release 5.12, and everybody else that was still
there challenged us to run two instances of it at the same time and see if it
would multitask.