Skip to content

Instantly share code, notes, and snippets.

@ebot
ebot / post_xml.js
Last active August 29, 2015 14:06
Sample cscript jscript for posting xml to a web site with basic authentication
var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
xmlhttp.open("POST","http://server/path/here/page_her.aspx", false, "user_name_here", "secret_pass_here");
xmlhttp.send("<Root><Node><Param Id=\"0EBFAE2E-40EE-11E0-A8BC-0019B9B66271\"/></Node></Root>");
WScript.Echo(xmlhttp.responseXML.xml);
@ebot
ebot / gist:007d996cd8b23599b558
Last active August 29, 2015 14:04
windows vimrc customizations for work laptop
autocmd BufEnter *.markdown,*.md exe 'noremap <F5> :!start "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" %:p<CR>'
let NERDTreeWinSize=20
if has("gui_running")
set lines=50 columns=105
:winpos 800 1
@ebot
ebot / SimpleThread.java
Last active August 29, 2015 13:57
Fun with java threads, exceptions, and exception handlers
public class SimpleThread extends Thread {
private int countDown = 5;
private boolean triggerExceptions = false;
public SimpleThread( boolean enableHandler, boolean triggerExceptions) {
super("Error Test"); // Store the thread name
this.triggerExceptions = triggerExceptions;
if (enableHandler) setHandler();
start();
@ebot
ebot / hello.rs
Created January 20, 2014 00:04
My first basic rust program.
use std::io::buffered::BufferedReader;
use std::io;
fn get_name() -> ~str {
println!("What is your first name?");
let mut reader = BufferedReader::new(io::stdin());
let name = reader.read_line().unwrap_or(~"nothing");
return name.trim().to_str();
}
@ebot
ebot / coffebot.ino
Created August 16, 2013 02:10
Our Coffeebot Arduino Brain
/*
* CoffeeBot Command: Control a coffeebot with a remote or via sensors
* Version 0.1 - August, 2013
* By Ed Botzum
* http://edbotz.us
* This is an arduino scrip that allows users to switch their coffeebot
* between senor mode and Remote Mode by clicking the func/stop button
* on the remote.
*
@ebot
ebot / fix_frank.rb
Last active December 19, 2015 02:49
Oh Wilbur, we will call you Frank.
#!/usr/bin/env ruby -wKU
require 'fileutils'
def fix_frank(dir_name)
Dir.new(dir_name).each do |file_name|
file_path = File.join dir_name, file_name
index_path = File.join file_path, 'index.txt'
if file_name == 'data' and File.exist? index_path
puts " Checking for \"FRANK\" in #{index_path}"
franks = 0
require 'fileutils'
require 'zip/zip'
def unzip_file(file_name, dir_name)
puts "Unzipping #{file_name} to #{dir_name}."
Zip::ZipFile.open(file_name) do |zip_file|
zip_file.each do |f|
f_path=File.join(dir_name, f.name)
FileUtils.mkdir_p(File.dirname(f_path))
zip_file.extract(f, f_path) unless File.exist?(f_path)
@ebot
ebot / find_dupes.rb
Created May 24, 2013 21:14
Locate dupes in the batch file tags.
require 'FileUtils'
tag_files = {}
Dir.glob( './upload/*.tag' ).each do |file|
name = File.basename file, '.tag'
fields = name.split '_'
name = fields[fields.length - 1]
tag_files[name] = [] if tag_files[name].nil?
tag_files[name] << file
end
@ebot
ebot / test_audo.js
Created March 30, 2013 21:06
Sets the volume to 100% and plays random mp3s to test the raspberry pi audio.
var sys = require('sys');
function playRandomSound() {
var num = Math.floor(Math.random()*13);
if (num == 0) {
num = "09";
}
else if (num < 10) {
num = '0' + num;
@ebot
ebot / MyDimmer.ino
Created March 7, 2013 00:56
MyDimmer example for sending data to an Arduino board through the serial port with Processing.
/*
MyDimmer
My hack of the script created by David Mellis, Tom Igoe and Scott Fitzgerald.
http://www.arduino.cc/en/Tutorial/Dimmer
The script to reads bytes of input from the serial port and uses it to contol the brightness of an LED on pin 9.
Mine lights an additional indicator LED on pin 7 as an indicator.