Skip to content

Instantly share code, notes, and snippets.

View scottslowe's full-sized avatar

Scott S. Lowe scottslowe

View GitHub Profile
@scottslowe
scottslowe / puppet-ifcfg-manifest
Last active December 14, 2015 04:08
This snippet of Puppet code could be used on RHEL/RHEL variants to help automate the configuration of OVS.
# This code declares a file resource to manage an interface
# configuration script on RHEL/RHEL variants for automated
# configuration of OVS.
#
file {'/etc/sysconfig/network-scripts/ifcfg-mgmt0':
ensure => 'present',
source => 'puppet:///modules/module-name/ovs-ifcfg-mgmt0',
}
@scottslowe
scottslowe / custom-pf-conf
Created May 15, 2013 04:46
Very simple configuration file for pf on OS X Mountain Lion
anchor "org.scottlowe.pf"
load anchor "org.scottlowe.pf" from "/etc/pf.anchors/org.scottlowe.pf.rules"
@scottslowe
scottslowe / simple-pf-anchor
Created May 15, 2013 04:53
A very simple set of pf rules, in the right order, that might be used with pf on OS X Mountain Lion
# Options
set block-policy drop
set fingerprints "/etc/pf.os"
set ruleset-optimization basic
set skip on lo0
# Normalization
# Scrub incoming packets
scrub in all no-df
@scottslowe
scottslowe / pf-launchd-item
Created May 15, 2013 05:00
This is a launchd item that you could use to automatically start pf on OS X Mountain Lion at boot.
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE plist PUBLIC "-//Apple Computer/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.scottlowe.pf.plist</string>
<key>Program</key>
<string>/sbin/pfctl</string>
<key>ProgramArguments</key>
<array>
@scottslowe
scottslowe / ubuntu-vlan-interface
Last active December 17, 2015 19:09
This snippet of configuration from /etc/network/interfaces will configure a VLAN interface on an Ubuntu system.
auto eth0.20
iface eth0.20 inet static
vlan-raw-device eth0
address 192.168.20.200
netmask 255.255.255.0
network 192.168.20.0
broadcast 192.168.20.255
@scottslowe
scottslowe / ubuntu-tep-policy-routing
Created May 28, 2013 19:52
This snippet of configuration from /etc/network/interfaces shows how to add custom policy routing rules and custom routes when the interface is brought up
auto tep0
iface tep0 inet static
address 192.168.200.10
netmask 255.255.255.0
network 192.168.200.0
broadcast 192.168.200.255
post-up ip rule add from 192.168.200.10 lookup tunnel
post-up ip route add default via 192.168.200.1 dev tep0 table tunnel
@scottslowe
scottslowe / bbedit-to-marsedit-script
Last active October 8, 2019 00:38
This AppleScript takes Markdown text from BBEdit, runs it through MultiMarkdown, then through TextSoap, and finally posts it to a new entry in MarsEdit.
-- Set some global values to be used later in the script
property markdownloc : "/usr/local/bin/multimarkdown"
on translate_line_breaks(str)
set AppleScript's text item delimiters to {ASCII character 13}
set _lines to every text item of str
set AppleScript's text item delimiters to {ASCII character 10}
set str to _lines as text
set AppleScript's text item delimiters to {}
return str
@scottslowe
scottslowe / mailtags-assign-keyword
Created June 15, 2013 13:20
This AppleScript, designed to be used with MailTags and Mail.app, assigns one or more keywords to the selected messages.
-- This script assigns MailTags keywords to the selected messages
-- Set some default values to be used later in the script
property assignedKeywords : {"Personal"}
-- Handler called when running script from script menu
on run
tell application "Mail"
set theSelectedMessages to selection
if ((count of theSelectedMessages) < 1) then
beep
@scottslowe
scottslowe / annual-archive-script
Created June 15, 2013 13:32
This AppleScript moves the selected messages to the specified archive mailbox. You must make sure the mailbox exists; the script doesn't check for its existence.
-- This script moves messages to a mailbox for the current year
-- Set some default values to be used later in the script
property theMailbox : "Archive"
-- Handler called when running script from script menu
on run
tell application "Mail"
set theSelectedMessages to selection
if ((count of theSelectedMessages) < 1) then
beep
@scottslowe
scottslowe / ovs-config-with-nvp
Created August 21, 2013 20:41
This output of "ovs-vsctl show" shows how OVS looks when integrated into NVP.
7e99f9f1-8ec7-48dd-8463-0e04dd5efc11
Manager "ssl:192.168.1.5:6632"
is_connected: true
Manager "ssl:192.168.1.6:6632"
is_connected: true
Manager "ssl:192.168.1.2:6632"
is_connected: true
Bridge br-int
Controller "unix:ovs-l3d.mgmt"
is_connected: true