More details in my blogpost at https://blog.sandipb.net/2020/08/05/notes-on-the-httprouter-golang-library/
View main.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"flag" | |
"log" | |
"net/http" | |
"os" | |
"os/signal" | |
"strconv" |
View gist:49f91868e83de9db70238dadfd0d80ca
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am sandipb on github. | |
* I am sandipb (https://keybase.io/sandipb) on keybase. | |
* I have a public key ASC4KMgsBE9a3n9l9GI0InNtbh-SzM49e_m3sNt7jlAY4Qo | |
To claim this, I am signing this object: |
View .bashrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SOCK="/tmp/ssh-agent-$USER-screen" | |
SOCKPTR="$(readlink -f $SOCK 2> /dev/null)" | |
if [[ -z $SOCKPTR ]] || [[ ! -S $SOCKPTR ]] | |
then | |
echo -e "\e[31m\e[1mNo valid current tmux ssh-agent link\e[0m" | |
if [[ -n $SSH_AUTH_SOCK ]] && [[ -S $SSH_AUTH_SOCK ]] | |
then | |
rm -f $SOCK |
View csv_to_avro.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import avro.schema | |
from avro.datafile import DataFileWriter | |
from avro.io import DatumWriter | |
import csv | |
import calendar | |
import time | |
schema = avro.schema.parse(open("weather.avsc").read()) |
View test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import ujson, json | |
data = '{ "prod-lsg1": { "max_float": 0.0046288111 } }' | |
print("json dumps, w/o precise float: ", json.dumps(ujson.loads(data))) | |
print("json dumps, w/ precise float: ",json.dumps(ujson.loads(data, precise_float=True))) | |
print("ujson dumps, w/o precise float: ", ujson.dumps(ujson.loads(data))) | |
print("ujson dumps, w/ precise float: ",ujson.dumps(ujson.loads(data, precise_float=True))) |
View benchmark_load.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import ujson | |
from timeit import repeat | |
def decode_json(data): | |
json.loads(data) | |
def decode_ujson(data, precise=False): |
View newcert.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# set -x | |
set -e | |
cd $(dirname $0) | |
# The path to the homebrew install on mac. Change to point to your own installation | |
OPENSSL="/usr/local/Cellar/openssl@1.1/1.1.1g/bin/openssl" | |
NAME=${1:?Need a hostname for generating certs} | |
DAYS=375 | |
export SAN="DNS:$NAME" |
View playbook.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: ubuntu | |
gather_facts: yes | |
vars: | |
kernel_does_not_match: "{{ (ansible_distribution == 'Ubuntu') and ( ansible_kernel != '5.4.0-86-generic') }}" | |
output_path_local: /tmp/host_kernels | |
tasks: | |
- block: | |
- name: Add matching host to file |
View README.md
Fix problem when cups-pdf (actually Ghostscript) refuses to print PDF files with restrictions
Specifically, even if the file has no printing restrictions, like many government forms do (my specific itch), Ghostscript refuses to print the file and generates a blank pdf.
Steps to fix
- Put contents of
unblockprint.sh
in an executable file named/usr/lib/cups/filter/unblockprint
. Make sure that the permissions of this file matches others in the same directory. - Put
local.convs
in/etc/cups
OlderNewer