Skip to content

Instantly share code, notes, and snippets.

@canimus
canimus / linkedin.rb
Last active August 29, 2015 14:22
Hackaton 1 Automation - Planit Perth
require 'watir'
require 'selenium-webdriver'
require 'base64'
require 'colorize'
require 'awesome_print'
profile = Selenium::WebDriver::Firefox::Profile.new
# 2 means custom folder
profile['browser.download.folderList'] = 2
#Specify the custom download folder
public static void main(String[] args) throws IOException {
// Setup firefox binary to start in Xvfb
String Xport = System.getProperty(
"lmportal.xvfb.id", ":1");
final File firefoxPath = new File(System.getProperty(
"lmportal.deploy.firefox.path", "/usr/bin/firefox"));
FirefoxBinary firefoxBinary = new FirefoxBinary(firefoxPath);
firefoxBinary.setEnvironmentProperty("DISPLAY", Xport);

Setup modern.ie vagrant boxes

Since modern.ie released vagrant boxes, it' no longer necessary to manually import the ova file to virtualbox, as mentioned here.

However, the guys at modern.ie didn't configured the box to work with WinRM. This how-to addresses that, presenting steps to proper repackage these boxes, adding WinRM support. Additionally configures chocolatey package manager and puppet provisioner.

Pre-requisites

@canimus
canimus / logstash-tomcat.rb
Created August 1, 2015 02:20
A parser for tomcat log files
input {
stdin {}
# file {
# path => ["/Volumes/VM/planit/1_customers/ecu/BB_logs/app_p2/archives/logs/tomcat/access/bb-access-log.*.txt" ]
# start_position => "beginning"
# }
}
filter {
grok {
@canimus
canimus / graph_block_raphael.html
Created December 7, 2010 20:40
How to create a block graph to show min, max and gross values with Raphael JS library
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="js/raphael.js" type="text/javascript" charset="utf-8"></script>
<script src="js/g.raphael-min.js" type="text/javascript" charset="utf-8"></script>
<title>Test: SVG</title>
<style type="text/css" media="screen">
div,h5,h6,h1,h2,h3,h4 {
@canimus
canimus / rehilete.html
Created November 20, 2011 21:24
Mexican Rehilete
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>D3 Examples</title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script type="text/javascript" src="js/d3.js"></script>
<script type="text/javascript" src="js/jquery-1.7.min.js"></script>
<script>
var blow_counter=1;
@canimus
canimus / README.md
Created January 20, 2012 19:55 — forked from mbostock/.block
Line Transition

D3’s default path interpolation is the same as its string interpolation: it finds numbers embedded in strings, and interpolates those numbers. So, the default behavior when interpolating two paths is like this:

M x0, y0 L x1, y1 L x2, y2 L x3, y3 
   ↓   ↓    ↓   ↓    ↓   ↓    ↓   ↓
M x0, y1 L x1, y2 L x2, y3 L x3, y4 

For example, the first point ⟨x0,y0⟩ is interpolated to ⟨x0,y1⟩. Since x0 is the same, all you see are the y-values changing (see example)—you don't see the path slide to the left as intended.

What you want to happen here is something like this:

@canimus
canimus / d3_area_graph.html
Created April 16, 2012 21:13
D3 Usage of Filters
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>D3 SLA Graph</title>
<style type="text/css">
body {
font: 10px 'Menlo';
margin-left: 0;
}
curl -G http://localhost:8086/query --data-urlencode "q=CREATE DATABASE racwa"
curl -i -XPOST 'http://localhost:8086/write?db=racwa' --data-binary @influx.line
curl -G 'http://localhost:8086/query?pretty=true' --data-urlencode "db=racwa" --data-urlencode "q=SELECT value FROM cache_on WHERE name='/'"
cat test.tsv | awk -F"\t" '{print "cache_on,client=racwa,region=ap-southwest-2 response="$1",latency="$2",status="$4",name=\""$5"\",code="$6",msg=\""$7"\",user=\""$8"\",bytes="$10",group="$11",active="$12",host=\""$13"\" "$3"000000"}' > influx.line
@canimus
canimus / new_box.sh
Last active October 13, 2015 14:01
Steps to create a new vagrant box from a base box
# Initialize Vagrantfile from base box
vagrant init ubuntu/trusty64
# Startup the box
vagrant up
# SSH to the box
vagrant ssh
# Update software