Skip to content

Instantly share code, notes, and snippets.

@williscool
williscool / script.py
Created January 24, 2022 22:02 — forked from Slokh/script.py
from api.lib.tasks.index_objects import index_objects
from api.lib.utils.list_utils import chunks
from api.lib.utils import get_logger
logger = get_logger()
start = datetime(2021, 11, 30, 17, 0)
end = datetime(2021, 11, 30, 17, 50)
asset_ids_created = AssetEvent.objects.using(settings.DB_REPLICA_LONG_QUERIES).filter(event_timestamp__gte=start, event_timestamp__lte=end, event_type="created").order_by('total_price').values('asset_id').distinct()
@williscool
williscool / chasepdf2csv
Created July 28, 2021 05:56 — forked from ivy/chasepdf2csv
Convert Chase credit card statements from PDF to CSV. Useful for importing old transactions into QuickBooks Online/Self-Employed.
#!/usr/bin/env ruby
# chasepdf2csv -- Convert Chase credit card statements from PDF to CSV. Written
# to easily import older statements into QuickBooks Online/Self-Employed. Chase
# unfortunately only offers statements up to 6 months in the past, making it a
# huge chore to synchronize past transactions.
#
# How to Use
# ----------
# This script requires Ruby >2.0.0 and pdftotext. Copy this script somewhere and
# make it executable. Run it like any other command.

Application Observability in Kubernetes with Datadog APM and Logging - A simple and actionable example

Last year I shared an example on how to realize application tracing in Kuberntes with Istio and Jaeger. After that, the industry has made some substantial headway on this front and we are seeing more vendor support as a result. At Buffer, since we primarily use Datadog for Kubernetes and application monitoring, it's only fitting to complete the circle with Datadog APM and Logging. I had a chance to create a small example for the team and would very much love to share with the community.

Okay, without further ado, let's dive in!

Installing Datadog agent

First thing first, in order to collect metrics and logs from Kubernetes an Datadog agent has to be installed in the cluster. The Datadog team ma

@williscool
williscool / facebook-wca-standard-events.html
Created January 22, 2020 00:55 — forked from danielmcclure/facebook-wca-standard-events.html
Sample Facebook Standard Events for New Facebook WCA (Website Custom Audience) Pixel
<!-- Facebook Custom Audience Pixel Code - Placed on Every Page of Site -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');
fbq('init', '{{facebook pixel}}');
fbq('track', 'PageView');
</script>
@williscool
williscool / readme.md
Created March 25, 2018 05:11
How to export tabs from mobile chrome
@williscool
williscool / filterEnum.ts
Created November 22, 2017 06:01
filterEnum in typescript
/**
* Filters am emum to only return the keys represented in it
*
* How is this not built into the language?
* https://stackoverflow.com/a/21294925/511710
* https://noahbass.com/posts/typescript-enum-iteration
*
* @param {{}} e
* @returns
*/
@williscool
williscool / journey-note-to-csv.js
Last active June 6, 2017 05:43
Journey Note Json To Csv
const fs = require('fs');
const glob = require('glob');
const json2csv = require('json2csv');
const options = {};
glob("*.json", options, function (er, files) {
// files is an array of filenames.
// If the `nonull` option is set, and nothing
// was found, then files is ["**/*.js"]
@williscool
williscool / cloudSettings
Last active January 19, 2021 06:56
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-01-19T06:56:32.553Z","extensionVersion":"v3.4.3"}
@williscool
williscool / permutations.js
Last active January 21, 2017 04:42 — forked from md2perpe/permutations.js
Function for generating permutations of a list.
// permutations(["c","a","t"])
function permutations(array){
if (array.length === 0) return [[]];
var perms = [];
for(var i = 0; i < array.length; i++) {
var copy = array.slice(0);
@williscool
williscool / Super Simple Ngnix Cors Proxy
Last active August 29, 2015 14:16
Not as simple as I thought it was at first. (you want to skip out fast if its an options request. and you want to make sure allow creds and methods and origin is set all the time)
server {
listen 80;
server_name yourserver.com;
#
# A CORS (Cross-Origin Resouce Sharing) config for nginx
#
# == Purpose
#