Skip to content

Instantly share code, notes, and snippets.

View metasyn's full-sized avatar

Xander Johnson metasyn

View GitHub Profile
@metasyn
metasyn / keybase.md
Created September 9, 2019 14:17
github identity proof

Keybase proof

I hereby claim:

  • I am metasyn on github.
  • I am metasyn (https://keybase.io/metasyn) on keybase.
  • I have a public key ASAN0Vq1KgweJgycHFa-cRsdG18cpCFSxB1BUNqFTrMWfQo

To claim this, I am signing this object:

#!/usr/bin/env python3
import sys
if __name__ == "__main__":
print("Inside a python process!")
print("Reading from stdin... (e.g. a chunk)")
print("="*70)
print(sys.stdin.readline())
print("="*70)
print("Exiting now from python!")
import osproc, logging, strutils, strformat
const defaultLog = "/tmp/nim-entrypoint.log"
when isMainModule:
addHandler(newFileLogger(defaultLog, fmtStr = verboseFmtStr))
info("Inside a nim process!")
let
programPath = "/opt/python/bin/python"
filePath = "reflector.py"
package main
import (
"io"
"log"
"os"
"os/exec"
"sync"
)
@metasyn
metasyn / prefix.nim
Last active July 1, 2018 03:46
Trying to figure out how to do things faster with parallelism in nim - See https://en.wikipedia.org/wiki/Prefix_sum
import times, sequtils, math, algorithm, strformat
proc ones(n: int): seq =
## Helper to make a sequence of ones
result = newSeq[int](n)
result.fill(1)
proc prefixSumWithPipes(p: seq): seq {.noInit.} =
result = p
var last = p
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 22 columns, instead of 21 in line 8.
,State,Account Length,Area Code,Phone,Int'l Plan,VMail Plan,VMail Message,Day Mins,Day Calls,Day Charge,Eve Mins,Eve Calls,Eve Charge,Night Mins,Night Calls,Night Charge,Intl Mins,Intl Calls,Intl Charge,CustServ Calls,Churn?
0,,,,,,,,,,,,,,,,,,,,,
1,OH,107.0,415.0,371-7191,no,yes,26.0,161.6,123.0,27.47,195.5,103.0,16.62,254.4,103.0,11.45,13.7,3.0,3.7,1.0,False.
2,NJ,137.0,415.0,358-1921,no,no,0.0,243.4,114.0,41.38,121.2,110.0,10.3,162.6,104.0,7.32,12.2,5.0,3.29,0.0,False.
3,OH,84.0,408.0,375-9999,yes,no,0.0,299.4,71.0,50.9,61.9,88.0,5.26,196.9,89.0,8.86,6.6,7.0,1.78,2.0,False.
4,OK,75.0,415.0,330-6626,yes,no,0.0,166.7,113.0,28.34,148.3,122.0,12.61,186.9,121.0,8.41,10.1,3.0,2.73,3.0,False.
5,AL,118.0,510.0,391-8027,yes,no,0.0,223.4,98.0,37.98,220.6,101.0,18.75,203.9,118.0,9.18,6.3,6.0,1.7,0.0,False.
6,MA,121.0,510.0,355-9993,no,yes,24.0,218.2,88.0,37.09,348.5,108.0,29.62,212.6,118.0,9.57,7.5,7.0,2.03,3.0,False.
7,MO,147.0,415.0,329-9001,yes,no,0.0,157.0,79.0,26.69,103.1,94.0,8.76,211.8,96.0,9.53,7.1,6.0,1.92,0
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# splunk search -> data -> topic Modeling
# xander johnson
from __future__ import division # python 2, so old school
# Splunk SDK
import splunklib.client as client
import splunklib.results as results
import numpy as np
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="Xander Johnson @metasyn">
<!-- WELCOME O DIGITAL TRAVELER
ydmmmmmddds+:/yhysooymNNmmmmNNmy//+ossysyyyysysysssysoossooo++++smms/:
hdmmmmmmddhy+//oyso++/smNMMMMmo+oosyyyyyyyyysyyyyyyyssyssyyssooo+smNh+