Skip to content

Instantly share code, notes, and snippets.

@load "ordchr"
function asciiCount(str, result, k){
for (k=1; k<=length(str); k++){
ascii = ord(substr(str, k, 1))
if ((ascii > 64 && ascii < 91) || (ascii > 96 && ascii < 123)){
result ++;
}
}
return result;
}
#cVim-link-container, .cVim-link-hint, #cVim-command-bar, #cVim-command-bar-mode, #cVim-command-bar-input, #cVim-command-bar-search-results, .cVim-completion-item, .cVim-completion-item .cVim-full, .cVim-completion-item .cVim-left, .cVim-completion-item .cVim-right, #cVim-hud, #cVim-status-bar {
font-family: Helvetica, Helvetica Neue, Neue, sans-serif, Arial;
font-size: 9pt !important;
-webkit-font-smoothing: antialiased !important;
border-radius: 4px!important;
}
#cVim-link-container {
position: absolute;
pointer-events: none;
SSID=SSID_GOES_HERE
pwgen -s 63 > 00wifi.txt
qrencode -o 00wifi.png "WIFI:T:WPA;S:${SSID};P:$(cat 00wifi.txt);;"
@paulvictor
paulvictor / stream.sh
Created June 21, 2019 03:33
Simulating a stream from a file
#!/usr/bin/env bash
i=0
ratePerSecond=1000000
port=5000
ratePerMS=$(($ratePerSecond/100))
while [ true ]
do
toRead=$((i*$ratePerMS))
b=`head $toRead $1 | tail -$ratePerMS`
i=$((i+1))
@paulvictor
paulvictor / keybase.md
Created March 15, 2019 11:33
keybase.md

Keybase proof

I hereby claim:

  • I am paulvictor on github.
  • I am paulvictor (https://keybase.io/paulvictor) on keybase.
  • I have a public key ASBW9fgmHto1UEB5qdFS4nh4ZFr0hLSpk23aewJgOsrvNgo

To claim this, I am signing this object:

@paulvictor
paulvictor / Trans.purs
Last active February 8, 2019 08:41
Translation of the latency function
pgLatency :: Array Page -> Array Event -> Int
pgLatency pages events =
snd <<<
runState
(for_
(pagesAndEventsSortedOnTime
(either
\p -> whenM ((\s -> fst s && isUsefulPage p) <$> get) (modify_ (snd >>> _ + p.latency))
\e -> whenM ((\s -> fst s && isUsefulEvent e) <$> get) (modify_ (fst >>> const true)))
)
@paulvictor
paulvictor / TransformersExample.js
Last active January 24, 2019 08:01
Nesting of Monads
exports.fetchPayload = null
exports.readHostNameFromSTDIN = null;
@paulvictor
paulvictor / Input.py
Created January 16, 2019 07:56
Translating from python to purs
def func():
i = 0;
j = 0;
for (x in xs)
i = i+1;
if (x.foo == "bar")
j += 1;
else
j += 0;
@paulvictor
paulvictor / StreamFromKinesis.js
Created September 21, 2018 07:30
Stream From Kinesis
var AWS = require("aws-sdk")
var options =
{ endPoint: "https://kinesis.ap-southeast-1.amazonaws.com"
, accessKeyId: ""
, secretAccessKey: ""
, region: "ap-southeast-1"
}
var request4 = new AWS.Kinesis(options).subscribeToShard(
{ "ConsumerARN": ""
, "ShardId": "shardId-"
@paulvictor
paulvictor / Producer.js
Created September 21, 2018 04:13
Stream from shard
var request4 = new AWS.Request(new AWS.Kinesis(options),
"subscribeToShard",
{ "ConsumerARN": "ARN", "ShardId": "shardId-0000000000XY" })
//var request4 = new AWS.Kinesis(options).subscribeToShard(
// { "ConsumerARN": "ARN"
// , "ShardId": "shardId-0000000000XY"
// })
var request4 = new AWS.Kinesis(options).listStreams()
//console.log(JSON.stringify(request4.service))