Skip to content

Instantly share code, notes, and snippets.

View TrevorS's full-sized avatar

Trevor Strieber TrevorS

View GitHub Profile
@TrevorS
TrevorS / internal_record.rb
Created November 5, 2012 20:47
Current InternalRecord Model
# == Schema Information
#
# Table name: internal_records
#
# id :integer not null, primary key
# error_status :string(2)
# creation_date :datetime
# direction :string(2)
# technology :string(4)
# calling_ton :integer
@TrevorS
TrevorS / load_fake_irds.rake
Created November 5, 2012 22:14
Inject random IDRs into database.
namespace :db do
desc "Injects a variable amount of fabricated Internal Data Records into the database."
task :load_fake_idrs, [:amount] => :environment do |t, args|
# convert the first argument into the number of records to create
num_records_to_make = args.amount.to_i
# set to true if we should print each record
print_records = false
# set to true if we should load each record
load_records = false
@TrevorS
TrevorS / parse-ciber.rb
Created November 8, 2012 16:18
Parse Ciber Records
#!/usr/bin/env ruby
# Author: Trevor Strieber
# Date : Nov 08 2012
require 'zlib'
require 'date'
def parse_line(line)
{
@TrevorS
TrevorS / Example.java
Last active December 12, 2015 04:38
GZIP Example
/**
* Parse a CIBER file.
* @param file the compressed or uncompressed CIBER file
*/
public void parseFile(File file) {
// Clear the record list.
clearTransaction();
// Set the current file name.
currentFileName = file.getName();
try {
$(document).ready(function() {
var operations = {};
// attach a date/time picker to the seizure start field and icon
$("#seizure_start").datetimepicker();
// attach a date/time picker to the seizure end field and icon
$("#seizure_end").datetimepicker();
// populate the query fields dependent on the switch selected
$("#search_switch_id").on('change', function() {
// start with clearing out the field options
$("#search_query_field").empty();
@TrevorS
TrevorS / switch_fields.rb
Last active December 14, 2015 00:09
Working with many to many through associations in Rails.
Switch.find(user_input)
.fields
.includes(:operations)
.includes(:operators)
.map { |field| [field.id, field.name, field.operators.map { |operator| [operator.id, operator.name] } ] }
# Returns:
# [[1, "Record Type", [[1, "="]]],
# [2, "Answer DateTime", [[1, "="], [3, ">"], [4, "<"], [5, ">="], [6, "<="]]],
# [3, "Answer Duration", [[1, "="], [3, ">"], [4, "<"], [5, ">="], [6, "<="]]],
@TrevorS
TrevorS / maven-output.txt
Created August 27, 2013 20:02
Example maven output
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building NokiaVoiceParser 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ NokiaVoiceParser ---
@TrevorS
TrevorS / faith-anne.txt
Created September 6, 2013 20:45
faith-anne.txt
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMZ$$I+===+====+=~==~=~=~~~~~~~~~~~~:~~~~~:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=+?IIIII77$$ZZOZZOOZZZ7??+++?I7$Z8MMMMMM
MMMM8+++++============~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~==+++===~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=+?I7777$$$ZOOOOO88OO$7MMMMM
MMMMZ++++=============~~~~~~~~~~~~~~~~~~:~~~~=~~=+I$ZZOOOOOOZOZ$I==~~:~~~~~~~~~~~~~~~~~~~~~~~~~~~=======+?I7$ZZZZOOMMMMM
MMMM$+++===========~~~~~~~~~~~~~~~~~~~~::~~~~=I$ZZOOOOOOOOOOO888OOZ$?~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~======+++++++++?MMMMM
MMMM7+===========~~~~~~~~~~~~~~~~:~~~~~~~~~=+$ZOOOOOOO88888OOOOOOOOOZZ?=~~::~::::~~~~~~~~~~~~~~~~~~=~=======++++++?MMMMM
MMMMI++=======~~~~~~~~~~~~~~~~~~:~~~~~~~~~=+$OOOOOOOOO8O88OOOOOOOOOOOOZZ7~~~:::::::~~~~::~~~~~~~~~~~~========+++++?MMMMM
MMMM?+======~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=IZZZZZOOOOOOO
SM_sdp1:/home/smadm/dump# tcpdump -S -nn -s 0 -XX -vvv \(dst 172.28.124.60 or src 172.28.124.60\) and not port 22
tcpdump: WARNING: BIOCPROMISC: Not owner
tcpdump: listening on en2, link-type 1, capture size 65535 bytes
10:53:46.017035 IP (tos 0x0, ttl 122, id 20285, offset 0, flags [none], proto: TCP (6), length: 44) 172.28.124.60.54418 > 172.20.71.47.1521: S, cksum 0xe468 (correct) 2732695011:2732695011(0) win 32120 <mss 1300>
0x0000: e41f 13a5 5724 0023 0418 dc80 0800 4500 ....W$.#......E.
0x0010: 002c 4f3d 0000 7a06 d5f2 ac1c 7c3c ac14 .,O=..z.....|<..
0x0020: 472f d492 05f1 a2e1 9de3 0000 0000 6002 G/............`.
0x0030: 7d78 e468 0000 0204 0514 0000 }x.h........
10:53:46.017072 IP (tos 0x0, ttl 60, id 30139, offset 0, flags [DF], proto: TCP (6), length: 44) 172.20.71.47.1521 > 172.28.124.60.54418: S, cksum 0x00e0 (correct) 88759046:88759046(0) ack 2732695012 win 65535 <mss 1460>
0x0000: 0000 0c9f f3f3 e41f 13a5 5724 0800 4500 ..........W$..E
@TrevorS
TrevorS / vagrant-suspend.log
Created November 8, 2013 21:08
The suspend that ran before vagrant up failed to resume correctly.
INFO global: Vagrant version: 1.3.5
DEBUG global: Loading core plugin: C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/commands/box/plugin.rb
INFO manager: Registered plugin: box command
DEBUG global: Loading core plugin: C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/commands/destroy/plugin.rb
INFO manager: Registered plugin: destroy command
DEBUG global: Loading core plugin: C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/commands/halt/plugin.rb
INFO manager: Registered plugin: halt command
DEBUG global: Loading core plugin: C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/commands/help/plugin.rb
INFO manager: Registered plugin: help command
DEBUG global: Loading core plugin: C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/commands/init/plugin.rb