Skip to content

Instantly share code, notes, and snippets.

View jrsconfitto's full-sized avatar

James Sconfitto jrsconfitto

View GitHub Profile
@jrsconfitto
jrsconfitto / alphabetizelines.rb
Created June 9, 2011 15:18
Alphabetizes the words in a file and then prints them line by line. There will be a line for each first character in each word.
#! ruby
# This script will take the words in a file or passed argument and alphabetize them. Then they will be put out with a line for each starting letter.
# This will help me with grabbing all the keywords and organzing them alphabetically by line so that in the future adding keywords to the Edict language spec will be easier since they are in an alphabetical list.
if ARGV.size == 1
lines = []
input = ""
output = ""
@jrsconfitto
jrsconfitto / chop.rb
Created June 13, 2011 22:09
Code Kata Two solutions
class Chop
def chop(target, values)
size = values.size
if size == 0
-1
elsif size == 1
(values[0] == target ? 0 : -1)
else
if target < values[size/2]
@jrsconfitto
jrsconfitto / RandomNumberSet.rb
Created September 26, 2011 13:57
This will generate random data that is timestamped in a CSV
#! ruby
# This will generate a negative number set that i can use for testing my compression analysis
#
# Example:
# NegNumSet numberOfPoints [max] [freq]
#
# Arguments (all are optional so far):
# 1: numberOfPoints - the number of points to generate
# 2: Max - the maximum distance from zero that the data point values can have
@jrsconfitto
jrsconfitto / GetUniqueOPCMethods.rb
Created November 14, 2011 21:47
Grab the unique OPC methods from an exported OPC Analyzer trace
#! ruby
#
# Gets the unique OPC methods from the OPC analyzer trace log of all the methods TopView Configurator and Engine uses
# Assumes that it has been given a valid file name
if ARGV.length == 1 and File.exists?(ARGV[0])
input = File.open(ARGV.first, "r").read
# Build up a unique array of OPC methods
opc_methods = []
@jrsconfitto
jrsconfitto / programmingAF.md
Created January 23, 2012 14:18
Programming PI AF

Programming PI AF

Just a few things that i'm learning

Event Frame Reference:

  • Built into the AF SDK.
  • Uses packages:
    • OSIsoft.AF.UI
  • OSIsoft.AFSDK
@jrsconfitto
jrsconfitto / tabfieldcount.rb
Created March 13, 2012 19:50
Will count the number of tab delimited fields in the passed file name
#! ruby
if ARGV.length == 1
if File.exists?(ARGV[0])
file = File.open(ARGV[0], "r")
puts "File name: #{ARGV[0]}"
count = 1
file.each do |line|
line_count = line.split("\t").count
@jrsconfitto
jrsconfitto / Tweets.cs
Created June 7, 2012 20:13
Grab a Twitter search result using RestSharp and some json classes
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace RestSharpLearning
{
public class Metadata
{
public string result_type { get; set; }
@jrsconfitto
jrsconfitto / RxUIExamples.md
Created October 9, 2012 20:33
RxUI Examples

Rx UI Examples

Examples for me since i can't seem to remember how the basics work!

WhenAny

@jrsconfitto
jrsconfitto / GHfW keyboard.md
Last active April 3, 2023 08:16
GitHub for Windows Keyboard Shortcuts

Keyboard shortcuts for GHfW

Here's a listing of all the GHfW keyboard stuff that i can think of. Now i know them after writing this, but i figured it would be nice to have these documentated somewhere.

Rant: i dont know why people say that Windows users dont like using the keyboard for everything. That's certainly not true for me. Though, that may be the case from using Unix in college.

All screens

You can use Alt shortcuts. Hold down Alt and you'll see the underlines. Menus brought up this way have j & k navigations! Try it on the tools menu.

@jrsconfitto
jrsconfitto / LoginModule.vb
Created November 6, 2012 19:56
Nancy Authentication issues i'm having
Imports Nancy
Imports Nancy.Authentication.Forms.ModuleExtensions
Imports Nancy.Extensions
Imports Nancy.Security
Imports System.Dynamic
''' <summary>
''' Handles all security related requests
''' </summary>
Public Class Login