Skip to content

Instantly share code, notes, and snippets.

View zzamboni's full-sized avatar
:octocat:

Diego Zamboni zzamboni

:octocat:
View GitHub Profile
@zzamboni
zzamboni / edit_sshd.cf
Created November 25, 2010 05:26
Cfengine bundle for editing sshd configuration file and restarting sshd if needed
# Parameters are:
# file: file to edit
# params: an array indexed by parameter name, containing the corresponding values. For example:
# "sshd[Protocol]" string => "2";
# "sshd[X11Forwarding]" string => "yes";
# "sshd[UseDNS]" string => "no";
# Diego Zamboni, November 2010
bundle agent edit_sshd(file,params)
{
files:
@zzamboni
zzamboni / add-outlook-task.ahk
Created December 23, 2010 18:13
Add a task to Outlook using powershell script
;----------------------------------------------------------------------
; Add a task to Outlook using powershell.
; InputBox reference: http://www.autohotkey.com/docs/commands/InputBox.htm
; PowerShell script from http://www.leeholmes.com/blog/2007/03/01/getting-things-done-%E2%80%93-outlook-task-automation-with-powershell/
#Space::
InputBox, description, Add task,,,,100
If (ErrorLevel == 0) {
; Running it through %comspec% and with the Hide option prevents a
; command windows from briefly opening when the command is
; executed.
@zzamboni
zzamboni / outlook_MakeTaskWithAttachmentFromMessage.bas
Last active March 17, 2018 23:46
Visual Basic code for creating tasks from email messages in Outlook. See full description at http://zzamboni.org/post/automatically-creating-tasks-from-email-in-outlook
' Make a task from a message, processing the subject to look for contexts like @home or @office, if
' any are found the new task is assigned to the matching category.
' For example if the subject contains "@of" and the @OFFICE category exists, it will be used.
' If the subject starts with "todo:" it will be removed before creating the task.
' Diego Zamboni, April 5th, 2011
' Set the string comparison method to Text ("AAA" = "aaa").
Option Compare Text
@zzamboni
zzamboni / mac-modifiers.el
Created November 28, 2011 15:54
Mac keyboard modifier mapping in Emacs
;; Make Command act as Meta, Option as Alt,
;; right-Option as Super
(setq mac-command-modifier 'meta)
(setq mac-option-modifier 'alt)
(setq mac-right-option-modifier 'super)
@zzamboni
zzamboni / cf-cmd.rb
Last active May 15, 2019 12:28
cf-cmd - A tool for running CFEngine snippets
#!/usr/bin/env ruby
#
# CFengine command-line test utility.
#
# Diego Zamboni, December 27th, 2011
#
# Run as "cf-cmd help" to see usage information.
require 'readline'
require 'tmpdir'
@zzamboni
zzamboni / list_targets.sh
Last active November 25, 2018 14:43 — forked from pvdb/list_targets.sh
List all targets (sometimes incorrectly referred to as "goals") in a GNU Makefile
#
# this gist can be used to list all targets, or - more correctly - rules,
# that are defined in a Makefile (and possibly other included Makefiles)
# and is inspired by Jack Kelly's reply to a StackOverflow question:
#
# http://stackoverflow.com/questions/3063507/list-goals-targets-in-gnu-make/3632592#3632592
#
# I also found this script - http://www.shelldorado.com/scripts/cmds/targets - which does
# something similar using awk, but it extracts targets from the "static" rules from a single
# Makefile, meaning it ignores any included Makefiles, as well as targets from "dynamic" rules
@zzamboni
zzamboni / test.cf
Created February 16, 2012 23:03
How to define in CFEngine 3 a class as the result of ORing several other classes
body common control
{
inputs => { "/var/cfengine/inputs/cfengine_stdlib.cf" };
bundlesequence => { "test" };
}
bundle agent test
{
vars:
"pkg" slist => { "one", "two", "three" };
vars:
"allparams" slist => getindices("$(params)");
secondpass::
"sshdparamlist" slist => grep("[^_].*", "allparams");
"sshdparams[$(sshdparamlist)]" string => "$($(params)[$(sshdparamlist)])";
classes:
"use_restart_cmd" not => strcmp("$($(params)[_sshd_restart_cmd])", "");
"secondpass" expression => isvariable("allparams");
"thirdpass" expression => isvariable("sshdparamlist");
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by configure, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ ./configure --enable-maintainer-mode --with-tokyocabinet
## --------- ##
## Platform. ##
7.4.9 edit_template
Type: string
Allowed input range: "?(/.*)
Synopsis: The name of a special CFEngine template file to expand
Example: