Skip to content

Instantly share code, notes, and snippets.

@sandfox
sandfox / lol_wut_1.js
Created January 19, 2018 16:01
Flow type fun
//@flow
const {curry, get} = require('lodash/fp');
const safePropC = curry((propName, item) => item && item.props && item.props[propName]);
const safeProp = (propName, item) => item && item.props && item.props[propName];
const data = {
props: {
name: "james",
@sandfox
sandfox / tags vs releases.md
Last active December 7, 2017 12:06
Whats the difference between git tags and github releases (a brief and incomplete answer)

github releases are (under the hood). Lightweight git tags + some metadata stored in github (but not in git’s data model itself). Lightweight tags are “just” a pointer/reference to a commit. (they cannot be neither signed or contain messages ,and support basically zero git metadata). They are like git branches, except they never move which commit they point to.

Annotated Tags (aka, full blown ones) consist of a “tag object” (which is like a commit object), and a pointer/reference to the tag object. Annotated tags support messages, signing, a fuck ton of git meta-data and are of course, stored in git’s own data model.

most git operations that work on tags only show/display/work on annotated tags and ignore lightweight tags.

Lightweight tags are mostly intended for making “throwaway” markers/bookmarks on your personal branches etc. By default git will not push them up the origin. (e.g if you use git push --follow-tags or have push.followTags on (git config --global push.followTags true). (`git push -

@sandfox
sandfox / README.md
Last active November 16, 2017 08:03
Jaeger open tracing stuff

Soo, this sort of works (things appear in the UI!). Turns out the docker run command we used from the example didn't expose enough ports to allow the terrible nodejs script I wrote to send data into the container. I also set the config in my script to always record spans rather than sampling a limited number.

  1. make a folder somewhere, in it save trace_gen.js and npm install jaeger-client in there too.

  2. Run a docker container that has the "backend" / collector stuff in it:

docker run -d -e COLLECTOR_ZIPKIN_HTTP_PORT=9411 -p5775:5775/udp -p6831:6831/udp -p6832:6832/udp \
  -p5778:5778 -p16686:16686 -p14268:14268 -p9411:9411 jaegertracing/all-in-one:latest
@sandfox
sandfox / update-status.sh
Created October 9, 2017 16:00 — forked from ecstasy2/update-status.sh
Bash script to update github commit status
#!/bin/bash
set -e
# Usage: ./update-status.sh --sha=somesha \
# --repo=edyn/service-identity \
# --status=pending \
# --message="Starting tests" \
# --context=edyn/e2e \
# --url=http://something.com
@sandfox
sandfox / README.md
Last active October 4, 2017 10:07
how to update a github status from the cli

The above command allows you to update the "status" for a given commit (sha). Generally a PR will have 2 status contexts you need to set and each of them will have a different target-url which you can find via travis website and some exploring.

  • continuous-integration/travis-ci/push
  • continuous-integration/travis-ci/pr

The following are the only external dependencies:

  • You need node 6+ installed and npx (npm i -g npx)
  • You also need a github auth token, I strongly recommend generating a one-off token here with the only the permission repo:status and deleting once you are finished.
@sandfox
sandfox / get_latest_tag.sh
Created April 12, 2017 16:42
get latest tag
#! /usr/bin/env sh
git tag | grep "^release/r\([0-9]\+\.[0-9]\+\.[0-9]\+\)$" | sed -e "s/release\/r//g" | sort -t. -k 1,1n -k 2,2n -k 3,3n | tail -1
@sandfox
sandfox / tools.md
Created March 9, 2017 09:11
The tools of lobste.rs
@sandfox
sandfox / a.js
Last active January 20, 2017 10:23 — forked from anonymous/a.js
const genericPool = require("generic-pool");
const factory = {
create: function() {
return new Promise(function(resolve, reject){
setTimeout(function(){
reject(new Error('cannot create resource'))
}, 1000)
})
},
@sandfox
sandfox / plan.md
Created November 2, 2016 10:58
yet-another-logger

things I think it should be/do

  • bole's singleton thing is pretty useful
  • one log level / method - log levels are such BS for the most part...
  • single output stream
  • support something like bole's object mode smart switch for the output stream
  • allow adding arbitary keys to a logger - like pino
  • defer setting many options till we call output
    • timestamp format
  • hostname