Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍🍳
Cooking up great code

Nathan LeClaire nathanleclaire

👨‍🍳
Cooking up great code
View GitHub Profile
@nathanleclaire
nathanleclaire / manifest.json
Created Mar 10, 2016
chrome extension contextmenus sample
View manifest.json
{
"name": "Context Menus Sample",
"description": "Shows some of the features of the Context Menus API",
"version": "0.6",
"permissions": ["contextMenus"],
"background": {
"scripts": ["sample.js"]
},
"manifest_version": 2
View treeToLinkedLists.py
class LinkedList:
next = None
val = None
def __init__(self, val):
self.val = val
def add(self, val):
if self.next == None:
self.next = LinkedList(val)
@nathanleclaire
nathanleclaire / machine.py
Created Aug 7, 2015
Ansible dynamic inventory plugin for Docker Machine
View machine.py
#!/usr/bin/env python
"""
Example Usage:
$ ansible -i machine.py machinename -m ping
"""
import argparse
import subprocess
View OTelSpan.java
Span span = tracer.scopeManager().activeSpan();
span.setAttribute("metric_name", "metric_value");
@nathanleclaire
nathanleclaire / bootstrap-multihost.sh
Last active Sep 27, 2020
Script to bootstrap multihost swarm with Docker Machine (DIGITALOCEAN_ACCESS_TOKEN env var must be set, and experimental client binary available as dockerx locally)
View bootstrap-multihost.sh
#!/bin/bash
set -e
# Create this many swarm workers
export N_WORKERS=1
# Coloring info
export bold=$(tput bold)
export normal=$(tput sgr0)
@nathanleclaire
nathanleclaire / Dockerfile
Last active Jul 17, 2020
Secure Tenancy on Kubernetes
View Dockerfile
FROM debian:stretch-slim
RUN mkdir -p /srv/hny && \
apt-get update && \
apt-get install -y ca-certificates openssl bzip2
WORKDIR /srv/hny
# Need to build with tarball (provided by HNY team) adjacent in docker build directory
COPY st.tbz st.tbz
RUN tar --strip-components 1 -xjf st.tbz && \
View garch.py
#Import Requirements-----------------------------------------------------------
from arch import arch_model
import datetime as dt
from datetime import datetime, timedelta
import pandas as pd
from yahoo_fin import stock_info as si
#Set Date Range----------------------------------------------------------------
start = dt.datetime(2000,1,1)
View beeline_test.js
var http = require('http');
var beeline = require('honeycomb-beeline')({
writeKey: "key",
dataset: "nathanleclaire.nodejsbeelinetest",
serviceName: "frameworks-are-bloated-http-directly-rules"
});
//create a server object:
http.createServer(function (req, res) {
let trace = beeline.startTrace();
@nathanleclaire
nathanleclaire / DebugResponseObserver.java
Created Mar 10, 2020
Generic filter with context injection - Honeycomb Java Beeline implementation
View DebugResponseObserver.java
package com.mycompany.config.filters;
import io.honeycomb.libhoney.ResponseObserver;
import io.honeycomb.libhoney.responses.ClientRejected;
import io.honeycomb.libhoney.responses.ServerAccepted;
import io.honeycomb.libhoney.responses.ServerRejected;
import io.honeycomb.libhoney.responses.Unknown;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
@nathanleclaire
nathanleclaire / HoneycombFilterRegistration.java
Created Mar 9, 2020
filters with Honeycomb Java Beeline - Spring Boot Filter version
View HoneycombFilterRegistration.java
package org.springframework.samples.petclinic.system;
import io.honeycomb.beeline.DefaultBeeline;
import io.honeycomb.beeline.spring.beans.SpringServletFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.swing.*;
import java.util.Arrays;