Skip to content

Instantly share code, notes, and snippets.

require 'ostruct'
UFW_SECTIONS = [:ufw_new_resource, :ufw_protocol, :ufw_src_addr, :ufw_src_port, :ufw_dest_addr, :ufw_dest_port]
def build_cmd
UFW_SECTIONS.collect{ |action| self.send(action)}.join(" ")
end
def ufw_new_resource
"ufw #{new_resource.action}"
#!/usr/bin/ruby
# as of 20100101 requires the latest yajl-ruby
# http://github.com/brianmario/yajl-ruby
require 'rubygems'
require "yajl/http_stream"
require 'em-http'
require 'mq'
#!/usr/bin/ruby
# uses rest_client and carrot, seems to quit when no more data is in the stream
require 'rubygems'
require "yajl/http_stream"
require 'rest_client'
require 'carrot'
def main
require 'rubygems'
require "yajl"
require 'em-http'
require 'happening'
def main
EM.run {
parser = Yajl::Parser.new
parser.on_parse_complete = (Proc.new { |hash|
if hash["id"]
sudo apt-get install libboost1.40-all-dev libnids-dev libnids1.21 libpcap-dev libpcap0.8 pkg-config libglib2.0-dev libnet1-dev libnet1
./configure
make # this will fail
cd src
g++ -g -O2 -o justniffer main.o formatter.o utilities.o regex.o -L../lib/libnids-1.21/src -lnids2 -lpcap -L/usr/lib -lboost_regex-mt -lboost_program_options-mt -lnet -lglib-2.0 -lgthread-2.0
cd ..
make
make install
(* ocamlopt -g str.cmxa haproxy_error_flags.ml -o haproxy_error_flags *)
open Printf
let doublehyphen = Str.regexp "--"
let flagshash = Hashtbl.create 2000;;
(* http://groups.google.com/group/fa.caml/msg/0e938e47479af474 *)
let lines fname =
let cin = open_in fname in
/*
mostly stolen from:
http://github.com/bagder/curl/blob/master/docs/examples/http-post.c
to compile:
gcc -lcurl post.c -o post
*/
<?xml version="1.0" encoding="UTF-8"?>
<geocheck>
<status>not-valid</status>
</geocheck>
<proxycheck>
<status>false</status>
</proxycheck>
cp -R path/to/old/release app_0.9
cp -R path/to/new/release app_1.0
cp app_1.0/releases/1.0/app.rel app_1.0.rel
LIBPATH="app_0.9/releases/*/ */lib/*/ebin"
erl +Bd -noinput -noshell -pa $LIBPATH -eval 'systools:make_relup("app_1.0", ["app"], ["app"])' -run init stop
erl +Bd -noinput -noshell -pa $LIBPATH -eval 'systools:make_script("app_1.0", [] )' -run init stop
erl +Bd -noinput -noshell -pa $LIBPATH -eval 'systools:make_tar("app_1.0")' -run init stop
tar zxvf app_1.0.tar.gz
cp app_1.0/releases/1.0/start_clean.boot releases/1.0/
cd releases/1.0/
{
"id": "0123456789abcdef",
"name": "myname",
"provider": "puppet",
"role": "some_identifier_from_cm_system_can_be_nil?",
"timestamp": 1290616560,
"provisioned": "true",
"os": {
"name": "linux",
"version": "2.6.35-22-generic",