Skip to content

Instantly share code, notes, and snippets.

View zzamboni's full-sized avatar
:octocat:

Diego Zamboni zzamboni

:octocat:
View GitHub Profile
# From http://blog.macromates.com/2006/wrapping-text-with-regular-expressions/
def wrap_text(txt, col = 80)
txt.gsub(/(.{1,#{col}})( +|$)\n?|(.{#{col}})/,
"\\1\\3\n")
end
; One of my recent favorite pieces of Emacs configuration. The % command was one of the things I missed the
; most in Emacs, until I found this little gem. I modified it from its original source by adding
; previous-line and next-line to the list of commands.
; From http://www.emacswiki.org/emacs/ParenthesisMatching#toc4
(defun goto-match-paren (arg)
"Go to the matching parenthesis if on parenthesis AND last command is a movement command, otherwise insert %.
vi style of % jumping to matching brace."
(interactive "p")
(message "%s" last-command)
(if (not (memq last-command '(
#
# Sample cf3 implementation of "single copy nirvana" from
# http://cfwiki.org/cfwiki/index.php/Singlecopy_Nirvana
#
# Time-stamp: <[cf3-singlecopy.cf] modified by Diego Zamboni on Monday, 2010.08.23 at 01:44:19>
#
body common control
{
bundlesequence => { "copyfiles" };
# Find all network interfaces that match a certain IP address.
# Time-stamp: <[netif_find.cf] modified by Diego Zamboni on Tuesday, 2010.08.24 at 01:53:03>
body common control
{
bundlesequence => { "test" };
}
bundle agent test
{
# Sets the RHS of configuration items in the file of the form
# LHS RHS
# If the line is commented out with #, it gets uncommented first.
# Adds a new line if none exists.
# The argument is an associative array containing v[LHS]="rhs"
# Based on set_variable_values from cfengine_stdlib.cf, modified
# by Diego Zamboni to use whitespace as separator, and to handle
# commented-out lines.
bundle edit_line set_config_values(v)
files:
suse_9::
"${sys.workdir}/bin"
perms => usystem("0700"),
copy_from => mycopy("${repository}/bin/suse_9"),
depth_search => urecurse("1");
vars:
"suffixes" slist => { "${sys.flavour}" };
files:
"${sys.workdir}/bin"
perms => usystem("0700"),
copy_from => mycopy("${repository}/bin.${suffixes}"),
depth_search => urecurse("1");
"suffixes" slist => { "${sys.fqhost}", "${sys.domain}", "${sys.flavour}",
"${sys.ostype}", "${myarbitraryvariable}", "" };
@zzamboni
zzamboni / gist:566376
Created September 5, 2010 22:14
AutoHotKey configuration to open my Inbox in OneNote
; AutoHotKey configuration to open my Inbox in OneNote.
; To use this, change the file path to the path of the GTD notebook
; you want to use. You may also want to change the key to which it
; is assigned (I use Win-i).
#i::Run c:\Users\zambonid\Documents\OneNote Notebooks\GTD\INBOX.one
@zzamboni
zzamboni / pygments_cfengine_lexer.py
Last active November 25, 2018 14:30
Lexer for cfengine3 policy files, for use with Pygments
# -*- coding: utf-8 -*-
"""
pygments.lexers.cfengine
~~~~~~~~~~~~~~~~~~~~~
Lexer for cfengine3 policy files. Should probably be incorporated into other.py
Written by Diego Zamboni <diego@zzamboni.org>
"""