Skip to content

Instantly share code, notes, and snippets.

View jaytaph's full-sized avatar
:shipit:
Calculating pi

Joshua Thijssen jaytaph

:shipit:
Calculating pi
View GitHub Profile
@jaytaph
jaytaph / README
Created October 10, 2012 07:51
my first Vagrantfile
Downloads the lucid32 box, clones a new virtual machine and starts it.
Start the machine by using "vagrant up".
Log into the machine by using "vagrant ssh".
Shutdown the machine by "vagrant destroy".
@jaytaph
jaytaph / README
Created October 14, 2012 07:23
Simple multi VM system
Simple multi VM system.
* Use "vagrant up" to install 3 vagrant boxes.
* Use "Vagrant ssh master|node1|node2" to ssh into the respective VM
* Most vagrant commands will need the additional nodename to work ("vagrant reload node1" for example)
@jaytaph
jaytaph / README
Created October 14, 2012 08:04
Multi VM with puppet master and 2 nodes
Simple multiVM system for 1 puppetmaster and 2 puppet nodes (not configured).
Uses a simple site.pp file as a provisioner that sets the /etc/host with the correct IP's of the virtualboxes.
@jaytaph
jaytaph / gist:3887955
Created October 14, 2012 08:26
Added very crude apache webserver to node2
class apache {
package { "httpd" :
ensure => installed,
}
service { "httpd" :
ensure => running,
require => Package["httpd"];
}
}
#!/bin/sh
_complete_console() {
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
console="${COMP_WORDS[0]}"
cmds=` ${console} | tail -n +6 | grep '^ ' | awk '{ print $1 }' `
namespace eval moin {
bind pubm -|- * moin::moin
}
proc moin::moin { nick host handle chan text } {
if {[regexp -nocase -- {(^moin|^mornin)} $text]} {
putserv "PRIVMSG $chan :$nick moin"
}
}
@jaytaph
jaytaph / twitter.tcl
Last active December 9, 2015 22:08 — forked from anonymous/twitter.tcl
package require http
namespace eval twitter {
variable status_url "http://api.twitter.com/1/statuses/user_timeline/"
bind pub -|- "!twitter" twitter::tweet
}
proc twitter::tweet {nick uhost hand chan argv} {
if {[string length $argv] < 1} {
@jaytaph
jaytaph / saffire.sf
Last active December 10, 2015 05:38 — forked from anonymous/gist:4389353
class saffire {
// Returns saffire version (should be tuple major.minor.build)
public method version();
// Returns the git revision which was used for building this saffire version
public method git_revision();
// Returns the current run_mode: "fastcgi", "repl", "cli"
public method run_mode();
class foo {
public method bar(... args) {
for (i=0; i!=args.count(); i++) {
io.printf("arg %d : %s", i, args[i]);
}
}
public method baz(... args) {
self.bar(args); // This would send a list, so bar only has 1 argument
self.bar(... args); // maybe something like this, use the ... to tell that we are sending a varlist?
@jaytaph
jaytaph / foreach.sf
Last active December 10, 2015 09:59
pq = PriorityQueue[5:"foo":10, 5:"bar":2, 10:"baz":0, 1:"wuq":0];
foreach (pq as key:value:prio, meta) {
if (meta.first) io.print("This is the first item!\n");
if (meta.last) io.print("This is the last item!\n");
io.print("Key: ",key," Val: ",value," Prio: ", prio);
}
Output:
This is the first item!