Skip to content

Instantly share code, notes, and snippets.

@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 / MyBlink.ino
Created February 13, 2013 23:24
My Arduino samples.
@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 / 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 / Recursion.java
Created October 9, 2012 16:24
Samples for Donita
public class Recursion {
private String sentence;
public Recursion(String sentence) {
this.sentence = sentence;
}
public String getSentence() {
return sentence;
}
@ebot
ebot / count_csvs.rb
Created September 20, 2012 16:12
Compare's Iron Mountain's actual documents with what their csvs say should be there.
#!/usr/bin/env ruby -wKU
require 'faster_csv'
puts "Reading the Iron Mountain CSVs"
encounters = Hash.new
error_text = ''
enc_no = '' # Include information from a specific encounter
lines = 0
Dir.glob( '*.csv' ).each do |file|
require 'nokogiri'
# Read the csv and check each file listed like so
doc = File.read 'file_name.xml'
check_marks = doc.xpath("/ClinicalDocument/StructuredBody/section/title[starts-with(text(), 'CHECK')]/../text/text()").collect(&:text)
add_to_report if check_marks.nil?
require 'fastercsv'
require 'fileutils'
require 'date'
docs = {}
rename = {}
FasterCSV.foreach( 'dupe_docs.txt', :headers => true, :col_sep => ';' ) do |row|
begin
fname = "#{row['OwnerFolderDate'].split(' ')[0]}_#{row['OwnerTypeName'].strip}_#{row['DocTypeName'].strip}_#{row['file_name']}"
folder = "#{DateTime.parse( row['OwnerFolderDate']).strftime('%Y')}-data"
@ebot
ebot / make_echo_additions.rb
Created May 15, 2012 17:15
Splits unmatched accounts into an additions file for the mainframe.
#!/usr/bin/env ruby -wKU
input = File.new 'accounts.txt', 'r'
output = File.new 'additions.txt', 'w'
input.each_line do |line|
line = line.chomp.strip
enc = line.split '-'
output << " #{'%011d' % enc[0]}#{enc[1]}\n" unless line.nil?
end
@ebot
ebot / connect.coffee
Created March 21, 2012 19:53
Nodejs script that is the simplest possible way to log into a remote server with basic authentication.
http = require("http")
uname = "uname"
pword = "pword"
options =
host: "server_name_or_ip"
port: 80
path: "/path/to/page.aspx"
headers: