Skip to content

Instantly share code, notes, and snippets.

@wheresalice
wheresalice / drupal_spec.rb
Created April 8, 2010 15:14
rspec file to check the basics of a Drupal site
require 'rubygems'
require 'watir'
require 'spec'
Watir::Browser.default = 'firefox'
describe "test Drupal frontend" do
before(:each) do
@browser ||= Watir::Browser.new
@domain ||= 'example.org'
@wheresalice
wheresalice / drupal.rb
Created April 8, 2010 12:33
Very basic test suite using Watir to ensure a Drupal site is working
#!/usr/bin/ruby1.9.1
require "rubygems"
require "test/unit"
require "watir"
$site = ARGV[0]
puts $site
if ($site[-1,1] != "/")
puts "url must end in a slash"
exit
end
@wheresalice
wheresalice / testgoogle.rb
Created April 14, 2010 13:05
A really simple example of using webrat and rspec for integration testing
require 'rubygems'
require 'webrat'
require 'spec/test/unit'
include Webrat::Methods
include Webrat::Matchers
Webrat.configure do |config|
config.mode = :mechanize
end
@wheresalice
wheresalice / gist:369822
Created April 17, 2010 21:49
Mass delete Tumblr posts
# http://lds.li/post/232870067/bulk-deleting-tumblr-posts
require 'rubygems'
require 'open-uri'
require 'mechanize'
require 'pp'
site_dashboard_url = 'http://www.tumblr.com/tumblelog/lstoll'
email = 'lstoll@lstoll.net'
password = 'xxxxxx'
@wheresalice
wheresalice / eject.rb
Created April 17, 2010 17:01
This should theoretically eject most cash drawers, but needs testing with actual hardware
@printer = "/dev/lp0"
File.open(@printer, "w") do |f|
f.print("#{27.chr}#{112.chr}#{0.chr}#{50.chr}#{250.chr}") # Citizen or Bixolon or IBM or Ithaca or Nexa or Olivetti or Pos-X or Posiflex or Samsung
f.print("#{7.chr}") # Citizen or IBM or Start or Westrex
f.print("#{27.chr}#{112.chr}#{48.chr}#{55.chr}#{121.chr}") # Bixolon or Epson or Samsung
f.print("#{27.chr}#{112.chr}#{0.chr}#{100.chr}#{250.chr}") # TEC or Toshiba or Unisys
f.print("#{27.chr}#{112.chr}#{0.chr}#{48.chr}#{251.chr}") # Axiohm or Fujitsu
f.print("#{27.chr}#{112.chr}#{0.chr}#{25.chr}#{250.chr}") # Epson or Samsung
f.print("#{27.chr}#{112.chr}#{0.chr}#{64.chr}#{240.chr}") # Epson or Samsung
f.print("#{27.chr}#{112.chr}#{1.chr}#{50.chr}#{250.chr}") # Citizen (Drawer 2)
@wheresalice
wheresalice / gist:374546
Created April 21, 2010 23:09
Fixes a bug in hexa-range and adds support for hexa-rand in wfuzz
diff -uNp --unidirectional-new-file /pentest/web/wfuzz/CHANGELOG wfuzz/CHANGELOG
--- /pentest/web/wfuzz/CHANGELOG 1970-01-01 01:00:00.000000000 +0100
+++ wfuzz/CHANGELOG 2010-04-22 00:04:00.000000000 +0100
@@ -0,0 +1,3 @@
+== 22 April 2010 kaerast <kaerast@computergentle.com> ==
+ * Added hexa-rand which fuzzes random hex values within a given range rather than consecutive values
+ * Fixed hexa-range to not send out an extraneous % sign
Binary files /pentest/web/wfuzz/dictio.pyc and wfuzz/dictio.pyc differ
Binary files /pentest/web/wfuzz/encoders.pyc and wfuzz/encoders.pyc differ
diff -uNp --unidirectional-new-file /pentest/web/wfuzz/payloads.py wfuzz/payloads.py
@wheresalice
wheresalice / aegir_modules.rb
Created April 23, 2010 10:06
Shows all modules available across all Aegir platforms. Doesn't test if they're in use or not
require 'find'
modules = []
Find.find('/var/aegir/platforms') { |file| modules << File.basename(file) if File.basename(file) =~ /\.module$/ }
puts modules.sort.uniq
@wheresalice
wheresalice / gist:446055
Created June 20, 2010 19:52
script for vbackup to support cfbackup so we can copy backup files to rackspace
#!/bin/bash
#
# This file is part of vbackup.
#
# vbackup is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# vbackup is distributed in the hope that it will be useful,
<pre>
<?php
$foo = array();
$foo['country'] = "united Kindom";
$foo['street'] = "";
$foo['state'] = "ENG";
print_r( $foo);
$bar = array();
$bar['country'] = "Danmark";
$bar['street'] = "";
@wheresalice
wheresalice / gist:490373
Created July 26, 2010 10:01
Switch a Drupal site to syslog logging with level user_6
/var/aegir/drush/drush.php disable dblog && /var/aegir/drush/drush.php enable syslog
echo 1 | /var/aegir/drush/drush.php variable set syslog_facility 176