Skip to content

Instantly share code, notes, and snippets.

@ebot
ebot / gist:4081114
Last active October 12, 2015 20:08
SET CONCAT_NULL_YIELDS_NULL OFF;
SELECT DISTINCT d.DocId,
gi8.GenIdxData + '->' + gi7.GenIdxData + '->' + gi6.GenIdxData + '->' + gi5.GenIdxData + '->' + gi4.GenIdxData + '->' + gi3.GenIdxData + '->' + gi2.GenIdxData + '->' + gi.GenIdxData AS folder_structure,
ot.OwnerTypeName AS doc_folder,
o.OwnerFolderDate AS folder_date,
o.OwnerCreateDTime AS folder_create_time,
gid.GenIdxDefDsplName AS label_name,
gi.GenIdxData AS label_value,
ot2.OwnerTypeName AS parent_folder2,
@ebot
ebot / quick_sort.rb
Created December 6, 2012 17:39
Reorders a csv file by the specified column.
#!/usr/bin/env ruby -wKU
require "csv"
begin
puts "Reordering the index.txt file"
# Read in the csv and set it up to be overwritten
csv = CSV.read( File.new( '../index.txt', 'r') ,
{ :headers => true, :col_sep => ';' } )
new = CSV.open( '../index.txt', 'w', { :col_sep => ';' } )
@ebot
ebot / MyBlink.ino
Created February 13, 2013 23:24
My Arduino samples.
@ebot
ebot / Karl.java
Last active December 13, 2015 21:49
import java.util.Date;
import com.siemens.directLine.edLink.database.JobInterface;
/*
* Created on Feb 18, 2013
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
@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.
@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 / 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
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 / 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
@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.
*