Skip to content

Instantly share code, notes, and snippets.

View afreeland's full-sized avatar

Aaron Freeland afreeland

View GitHub Profile
@afreeland
afreeland / Structs.go
Created April 5, 2018 12:51
Go: basic structs
package main
import (
"fmt"
)
func main() {
// We created two structs in the local execution stack...its better to do large objects in heap
@afreeland
afreeland / UserInput.go
Created April 5, 2018 12:50
Go: collect user input by reference
package main
import (
"fmt"
)
func main() {
fmt.Println("1) Generate Power Plant Report")
fmt.Println("2) Generate Power Grid Report")
fmt.Println("Please choose an option: ")
@afreeland
afreeland / Loop.go
Created April 5, 2018 12:49
Go: basic looping
package main
import (
"fmt"
)
func main() {
fmt.Println("Hello, playground")
for i:=0; i < 5; i++ {
@afreeland
afreeland / Intro.go
Created April 5, 2018 12:49
Go: basic branching
package main
import (
"fmt"
)
func main() {
fmt.Println("Hello, playground")
//foo := 1
@afreeland
afreeland / csv_sample.conf
Created November 6, 2017 14:11
Logstash - CSV sample
input {
file {
path => "C:\Users\afreeland\Documents\GitHub\ElasticImport\conf\appointment1.txt"
start_position => beginning
}
}
filter {
csv {
columns => [
@afreeland
afreeland / Tableau_2017.js
Created October 3, 2017 18:48
JS: Tableau My Agenda Scrape
(function(user){
let mySchedule = [ ['user', 'day', 'time', 'startDate', 'endDate', 'title', 'venue']];
var days = [].slice.call(document.querySelectorAll('.Sessions-heading'), 0)
function splitTime(timeStr, dayOfWeek){
// Split 1:30 pm - 3:30 pm, 1:30pm-3:30pm
// Into ['1:30 pm', '3:30 pm']
let _split = timeStr.toUpperCase().split(/\s?-\s?/)
@afreeland
afreeland / removeAllButOne.sql
Created July 24, 2017 14:53
SQL: Remove all duplicates except one
with cte as (
select
username,
start_time,
ROW_NUMBER() OVER(Partition by username, start_time order by end_time) as [rn]
from sometable
)
select * from cte
--delete cte
where [rn] > 1
@afreeland
afreeland / ps1
Created June 29, 2017 15:08
System Environment Path Variable to GitHub %GitHub% $env:GitHub
[Environment]::SetEnvironmentVariable("GitHub", $env:USERPROFILE + "\Documents\GitHub", "Machine")
2017-05-04 13:58:32> Program: Starting Squirrel Updater: --install .
2017-05-04 13:58:33> Program: Starting install, writing to C:\Users\JHenniger\AppData\Local\SquirrelTemp
2017-05-04 13:58:33> Program: About to install to: C:\Users\JHenniger\AppData\Local\MHSPortal
2017-05-04 13:58:33> Program: Install path C:\Users\JHenniger\AppData\Local\MHSPortal already exists, burning it to the ground
2017-05-04 13:58:34> Utility: DeleteDirectory: could not delete - C:\Users\JHenniger\AppData\Local\MHSPortal\app-0.1.1\resources\app\node_modules\babel-runtime\helpers: System.IO.IOException: The directory is not empty.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound)
at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost)
at Squirrel.Utility.<DeleteDirectory>d__19.MoveNext()
@afreeland
afreeland / gist:5dc6646d2de986feb9387097bf770852
Created May 4, 2017 17:29
Squirrel staging user ID...System.OutOfMemoryException
2017-05-04 10:14:54> Program: Starting Squirrel Updater: --install .
2017-05-04 10:14:54> Program: Starting install, writing to C:\Users\ebumgarner\AppData\Local\SquirrelTemp
2017-05-04 10:14:54> Program: About to install to: C:\Users\ebumgarner\AppData\Local\MHSPortal
2017-05-04 10:14:57> CheckForUpdateImpl: Couldn't write out staging user ID, this user probably shouldn't get beta anything: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\ebumgarner\AppData\Local\MHSPortal\packages\.betaId'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String ms