Skip to content

Instantly share code, notes, and snippets.

View kyleparisi's full-sized avatar

Kyle Parisi kyleparisi

  • Newtown, PA
View GitHub Profile
<html>
<head>
</head>
<body>
</body>
</html>
@kyleparisi
kyleparisi / xml-to-tsv.php
Last active November 14, 2016 13:29
This php script takes a local xml file input and stdouts the equivalent tsv.
<?php
/**
* This php script takes a local xml file input and stdouts the equivalent csv.
*/
$shortopts = "";
$shortopts .= "f:"; // Required value
$options = getopt($shortopts);
if (count($options) === 0) {
@kyleparisi
kyleparisi / stuff.sh
Created December 29, 2016 17:32
Debugging stuff
# Debug tcp requests and respond with 200
socat -v TCP-LISTEN:3000 "exec:printf \'HTTP/1.0 200 OK\r\n\r\n\'"
@kyleparisi
kyleparisi / date_looper.sh
Created January 20, 2017 18:15
Bash script that loops over dates for other atomic scripts
#!/bin/bash
# On linux use date, on mac gdate [via `brew install coreutils`].
# Will run from oldest date to today.
# $ sh date_looper.sh '2016-12-10'
currentdate=$1
loopenddate=$(gdate --date "$2 1 day" +%Y-%m-%d)
until [ "$currentdate" == "$loopenddate" ]
do
echo $currentdate
@kyleparisi
kyleparisi / index.js
Created February 9, 2017 14:23
Prototype of how to use lindy in a reactive setting (lindy modified slightly)
let init = lindy('h3', `Service running - false`);
let start = function () {
return lindy('button', {
onclick: () => this.emit('running', true)
}, 'Start Service');
};
let stop = function () {
return lindy('button', {
@kyleparisi
kyleparisi / index.html
Last active February 14, 2017 16:46
Electron starter
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
@kyleparisi
kyleparisi / brie.css
Created February 14, 2017 19:23
My go to set of sytles
body {
padding: 0;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont,
"Segoe UI", "Roboto", "Oxygen",
"Ubuntu", "Cantarell", "Fira Sans",
"Droid Sans", "Helvetica Neue", sans-serif;
}
.container {
export $(cat file.env | grep -v ^# | xargs);

Keybase proof

I hereby claim:

  • I am kyleparisi on github.
  • I am nargella (https://keybase.io/nargella) on keybase.
  • I have a public key ASCpsO1L3z4WwOId8Z04PSXmQeCiPDgXmFyBs3kbG-OfYAo

To claim this, I am signing this object:

@kyleparisi
kyleparisi / README.md
Last active August 30, 2017 13:10
General Node.js notes (+lambda)

General Node.js notes (+lambda)

  • I'd recommend sticking with es6 syntax (no async-await).
  • Always consider throttling
  • Try to make scripts atomically process data that fits the lambda time allotment
  • Connections [DB] should be handled at the top most points and always wrapped in a function
  • Scripts should always exit when done doing atomic work (dangling connections problem)
  • Logging should be using a single/configurable handler (verbosity, cli, parsable)
  • Logging should be done where you see neccesary but at a minimum at the tail end + top most point of the process for feedback on the atomic data processed (then and catch should be directly visible in the entry script)
  • .then(fn) - fn should either be stupidly simple or be extractable to the point of being able to be unit tested. The name should also be painfully obvious (reference)