Skip to content

Instantly share code, notes, and snippets.

View stonecobra's full-sized avatar

Scott Sanders stonecobra

View GitHub Profile
@stonecobra
stonecobra / file.py
Last active October 29, 2025 16:02
Python Otel span in async context
from opentelemetry import trace
from opentelemetry.trace import SpanContext, TraceFlags
from opentelemetry import context as trace_context
try:
span_context = SpanContext(
trace_id=trace_id,
span_id=span_id,
is_remote=False, # Indicate this context comes from the same process
trace_flags=TraceFlags(0x01) # Sampled
@stonecobra
stonecobra / Cargo.toml
Created April 26, 2022 02:39
Rust opentelemetry-otlp and tracing in a program as of 2022-04-25
[package]
name = "otel"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
opentelemetry = {version="0.17", features=["rt-tokio"]}
opentelemetry-otlp = {version="0.10", features = ["grpc-sys"]}
@stonecobra
stonecobra / csv-url-list-to-pdf.js
Created August 14, 2018 15:35
Use Pupeteer to convert a list of URLs to PDF
const fs = require('fs');
const parse = require('csv-parse');
const transform = require('stream-transform');
const puppeteer = require('puppeteer');
(async () => {
let browser = await puppeteer.launch();
let page = await browser.newPage();
@stonecobra
stonecobra / Link.js
Created November 3, 2016 00:31
Simple Link Element for Preact
@stonecobra
stonecobra / component-containing-router.js
Created October 30, 2016 18:43
Code splitting with webpack and preact-router
//choose your children, and when to load them.
getRouterChildren (url) {
let result = []
if (url === '/' || url === undefined) {
result.unshift(<DefaultComponent path='/' />)
} else if (url === '/a') {
require.ensure(['./a'], function (require) {
var page = require('./a').default()
page.attributes.path = '/a'
result.unshift(page)
{
"_id": "signal-exit",
"_rev": "9-6aaba3eb069771fdad1c361f70807d25",
"name": "signal-exit",
"description": "when you want to fire an event no matter how a process exits.",
"dist-tags": {
"latest": "1.3.1"
},
"versions": {
"1.0.0": {
#/bin/bash
/usr/local/bin/forever start -u "bens" -l /etc/npme/logs/bens.log -o /etc/npme/logs/bens.log -e /etc/npme/logs/bens.log -a -p /etc/npme /usr/local/bin/bens-quick-proxy -o 8081 -p http://svcsvnad:[email protected]:80 -t https://skimdb.npmjs.com
{
"npm-auth-ws": {
"module": "@npm/npm-auth-ws",
"description": "Global npm user auth WS",
"scripts": {
"start": "./bin/npm-auth-ws.js"
},v
"env": {},
"args": {
"start": "",
@stonecobra
stonecobra / TOS.MD
Created May 1, 2012 20:54
Google Drive TOS vs Google BigQuery TOS

Google Drive TOS

When you upload or otherwise submit content to our Services, you give Google (and those we work with) a worldwide license to use, host, store, reproduce, modify, create derivative works (such as those resulting from translations, adaptations or other changes we make so that your content works better with our Services), communicate, publish, publicly perform, publicly display and distribute such content. The rights you grant in this license are for the limited purpose of operating, promoting, and improving our Services, and to develop new ones. This license continues even if you stop using our Services (for example, for a business listing you have added to Google Maps). Some Services may offer you ways to access and remove content that has been provided to that Service. Also, in some of our Services, there are terms or settings that narrow the scope of our use of the content submitted in those Services. Make sure you have the necess

@stonecobra
stonecobra / gist:1174240
Created August 26, 2011 19:39
proxy sample
var https = require('https');
function hardProxy(request, response) {
var options = {
host: config.server.dbOptions.host
, method: request.method
, path: request.params[0]
, headers: getHeaders(request)
}
var req = https.request(options, function(res) {
res.on('data', function(chunk) {