Skip to content

Instantly share code, notes, and snippets.

View dtkav's full-sized avatar
👨‍🚀

Daniel Grossmann-Kavanagh dtkav

👨‍🚀
  • Hacking
  • Berkeley, CA
View GitHub Profile
@dtkav
dtkav / dug.sh
Last active September 2, 2016 02:03
dug: cd to bottom of directory tree (if you have several singly nested folders)
function dug() {
ls -d */ >/dev/null 2>&1;
if [[ $? -eq 0 && `ls -d */ | wc -l` -eq 1 ]];
then
builtin cd `ls -d */`;
dig;
fi
}
Verifying that +dtkav is my blockchain ID. https://onename.com/dtkav
@dtkav
dtkav / ephemerides-jsonp-lambda.py
Created September 2, 2016 07:26
ephemerides-jsonp-lambda
from __future__ import print_function
import urllib
import urllib2
import json
PLANET_URL = "http://ephemerides.planet-labs.com/planet_mc.tle"
def lambda_handler(event, context):
cb = event["params"]["querystring"].get("callback", "tle_data")

Keybase proof

I hereby claim:

  • I am dtkav on github.
  • I am dtkav (https://keybase.io/dtkav) on keybase.
  • I have a public key ASC8OLoL69bvPb7ZaW_dRwzOIJacND4cQaRd3hHA3_E7vwo

To claim this, I am signing this object:

@dtkav
dtkav / petstore.yml
Created May 2, 2018 05:12
spec that breaks swagger-ui
openapi: 3.0.0
servers: [] # this breaks swagger-ui
info:
title: Pet Shop Example API
version: '0.1'
paths:
/pets:
get:
tags:
- Pets
openapi: 3.0.0
#servers: [] # this breaks swagger-ui
info:
title: Pet Shop Example API
version: '0.1'
paths:
/pets:
get:
tags:
- Pets
@dtkav
dtkav / RFC-7809-jsonschema.yaml
Created October 4, 2018 04:54
RFC-7809-jsonschema.yaml
Error:
description: schema for problem+json (RFC 7807)
type: object
required:
- type
properties:
type:
description: A URI reference [RFC3986] that identifies the problem type.
type: string
format: uri
@dtkav
dtkav / json_spec.py
Created November 5, 2018 17:23
Connexion spec->json example
import json
from connexion.apis.abstract import Specification
spec = Specification.from_spec("swagger.yml")
json.dumps(spec.raw)
@dtkav
dtkav / 5grefox
Created February 25, 2019 00:16
firefox, but in a memory limited cgroup
#!/bin/bash
# create memory limited cgroup
sudo cgcreate -g memory:firefox
echo "5G" | sudo tee -a /sys/fs/cgroup/memory/firefox/memory.limit_in_bytes
echo "1" | sudo tee -a /sys/fs/cgroup/memory/firefox/memory.swappiness
# move shell to cgroup
echo $$ | sudo tee /sys/fs/cgroup/memory/firefox/tasks
# start firefox