Skip to content

Instantly share code, notes, and snippets.

View ipl31's full-sized avatar
🎯
Focusing

Ken Caruso ipl31

🎯
Focusing
View GitHub Profile
@ipl31
ipl31 / gist:93250dff37d3844b7ba6d7929fda2f3e
Created August 11, 2016 17:09 — forked from btm/gist:7cb421f5fe7d1003083a
Chef Postmortem Template
# INCIDENT DATE - INCIDENT TYPE
## Meeting
#### Waiving meetings
In some cases the IC might determine that a PM meeting for the incident isn't needed.
If the IC decides to waive the meeting please replace the `Meeting` section with a
note indicating the meeting has been waived (example: `Meeting waived: Paul Mooring`)
@ipl31
ipl31 / git-pass.sh
Created October 26, 2018 21:41 — forked from mpasternacki/git-pass.sh
Use multiple git-managed http://www.passwordstore.org/ stores
#!/bin/sh
set -e
# git-pass
# ========
# This script allows easy usage of http://www.passwordstore.org/ with
# multiple, Git-managed stores. It works both as self-standing shell
# script (that can be committed to the repository itself), or as a Git
# subcommand (in which case it should reside somewhere in $PATH or in
@ipl31
ipl31 / node_exporter.service
Last active June 6, 2020 15:21
Raspberry Pi Node Exporter Unit File
[Unit]
Description=Node Exporter
[Service]
# Provide a text file location for https://github.com/fahlke/raspberrypi_exporter data with the
# --collector.textfile.directory parameter.
ExecStart=/usr/local/bin/node_exporter --collector.textfile.directory /var/lib/node_exporter/textfile_collector
[Install]
WantedBy=multi-user.target
@ipl31
ipl31 / output.txt
Created January 16, 2020 20:44
Node exporter example output
# HELP go_gc_duration_seconds A summary of the GC invocation durations.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 7.0906e-05
go_gc_duration_seconds{quantile="0.25"} 8.5628e-05
go_gc_duration_seconds{quantile="0.5"} 8.998e-05
go_gc_duration_seconds{quantile="0.75"} 9.7221e-05
go_gc_duration_seconds{quantile="1"} 0.000375568
go_gc_duration_seconds_sum 0.104208159
go_gc_duration_seconds_count 981
# HELP go_goroutines Number of goroutines that currently exist.
@ipl31
ipl31 / main.py
Created March 13, 2020 20:15
Quant Connect Shareholder Yield Strategy
""" Shareholder Yield Algo.
This is for learning the QuantConnect Algo Framework. I don't expect it to be useful outside of that.
The goal of this algo is:
- create a universe of liquid stocks with the best share holder yield (dividends + buybacks) relative to the market.
- buy an equal weighted portfolio of these stocks.
- rebalance monthly based on share holder yield.
Classes:
- ShareHolderYieldAlgo() is the main class that configures and instantiates the QuantConnect algo framework.
@ipl31
ipl31 / quote.json
Created December 3, 2020 22:53
quote example
{
"symbol":"AAPL",
"companyName":"Apple Inc",
"primaryExchange":"ENSLA R GA(MT)KATGBELSO SC/NDEAQL",
"calculationPrice":"iexlasttrade",
"open":"None",
"openTime":"None",
"openSource":"filiacfo",
"close":"None",
"closeTime":"None",
#!/bin/bash
INPUTFILE="./sample.json"
SORTED_OUTPUT="./sorted-sample.json"
MISSING_FILE="./missing-records.txt"
TEMP_FILE=$(mktemp /tmp/clean.XXXXXX)
# Prepend the value from "id" the beginning of the line so we can use
# standard unix cli tools like sort. Save it to a temp file.
cat sample.json | jq -cr '"\(.id)\t\(.)"' > $TEMP_FILE
""" Test script to debug atexit SIGTERM handling """
import atexit
import os
import signal
import sys
import time
@atexit.register
def cleanup():
print("atexit handler called")