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 / ffmpeg_dark_magic.md
Created Jun 27, 2021
Encode YouTube compatible video file of just one image with audio using ffmpeg
View ffmpeg_dark_magic.md

Trying to crank out a video which is:

  1. YouTube compatible
  2. Small-ish
  3. Preserves lossless audio
  4. Doesn't crash VLC, etc. (this happened embedding a FLAC direct in a WMV)
  5. Encodes as quickly as possible

So far, the best I've come up with is as follows:

View OTelSpan.java
Span span = tracer.scopeManager().activeSpan();
span.setAttribute("metric_name", "metric_value");
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 / 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 && \
@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;
View osso11y.md

prom metrics -

class YourClass {
    static final Counter requests = Counter.build()
     .name("http_requests_total")
     .help("Total requests.")
     .labelNames(
         Arrays.asList(
         "http_status",
View example.java
import java.io.Serializable;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.ml.evaluation.RegressionEvaluator;
import org.apache.spark.ml.recommendation.ALS;
import org.apache.spark.ml.recommendation.ALSModel;
public static class Rating implements Serializable {
private int userId;
private int productId;
View FilterExampleServlet.java
package com.mycompany.servlet.filterlistener;
import io.honeycomb.beeline.DefaultBeeline;
import io.honeycomb.beeline.tracing.Span;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;