Skip to content

Instantly share code, notes, and snippets.

View pbnj's full-sized avatar
🖖
"May the Force ever be in your favor, Harry" -Gandalf

Peter Benjamin pbnj

🖖
"May the Force ever be in your favor, Harry" -Gandalf
View GitHub Profile
@pbnj
pbnj / index.js
Last active September 13, 2018 20:41
Demo Command-Line Interface (CLI) Application
#!/usr/bin/env node
'use strict';
/**
* Require dependencies
*
*/
const program = require('commander'),
chalk = require("chalk"),
exec = require('child_process').exec,
pkg = require('./package.json');
@pbnj
pbnj / citrix-netscaler-scripts.md
Last active January 22, 2016 22:02
Citrix Netscaler Policies/Rules

CITRIX NETSCALER


Author: Peter Benjamin
Date: 01/15/2016
Revised: 01/20/2016
Purpose: Instructions for setting up/configuring citrix netscaler as it pertains to Echo-Cloud.


Echo/Eyecom Configurations:

@pbnj
pbnj / interview-questions.md
Created January 17, 2017 23:34 — forked from jvns/interview-questions.md
A list of questions you could ask while interviewing

A lot of these are outright stolen from Edward O'Campo-Gooding's list of questions. I really like his list.

I'm having some trouble paring this down to a manageable list of questions -- I realistically want to know all of these things before starting to work at a company, but it's a lot to ask all at once. My current game plan is to pick 6 before an interview and ask those.

I'd love comments and suggestions about any of these.

I've found questions like "do you have smart people? Can I learn a lot at your company?" to be basically totally useless -- everybody will say "yeah, definitely!" and it's hard to learn anything from them. So I'm trying to make all of these questions pretty concrete -- if a team doesn't have an issue tracker, they don't have an issue tracker.

I'm also mostly not asking about principles, but the way things are -- not "do you think code review is important?", but "Does all code get reviewed?".

@pbnj
pbnj / run-as-cron.sh
Last active April 6, 2017 17:41
run as cron (cron debugging script)
#!/bin/bash -ex
# env > $HOME/cronenv
env -i $(cat $HOME/cronenv) "$@"
@pbnj
pbnj / introrx.md
Created April 24, 2017 17:53 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@pbnj
pbnj / gist:caa97e211513f7f3ed36d87727db6ada
Created November 22, 2017 23:29 — forked from oleksii-zavrazhnyi/gist:968e5ea87e99d9c41782
BASH Absolute path of current script
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

Is a useful one-liner which will give you the full directory name of the script no matter where it is being called from

These will work as long as the last component of the path used to find the script is not a symlink (directory links are OK). If you want to also resolve any links to the script itself, you need a multi-line solution:

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
@pbnj
pbnj / Dockerfile
Created November 28, 2017 00:26
Building Go binaries for bare OSes (e.g. alpine)
FROM golang:1.9 AS build
LABEL maintainer "Peter Benjamin"
WORKDIR /go/src/github.com/petermbenjamin/go-hello-world
COPY . .
RUN go get -u -v github.com/golang/dep/cmd/dep \
&& dep init \
&& CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o hello-world .
FROM alpine
COPY --from=build /go/src/github.com/petermbenjamin/go-hello-world/hello-world /usr/bin/hello-world
@pbnj
pbnj / README-setup-tunnel-as-systemd-service.md
Created May 11, 2019 19:14 — forked from drmalex07/README-setup-tunnel-as-systemd-service.md
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward

README

Create a template service file at /etc/systemd/system/secure-tunnel@.service. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target
@pbnj
pbnj / pandoc.css
Created May 18, 2019 03:49 — forked from killercup/pandoc.css
Add this to your Pandoc HTML documents using `--css pandoc.css` to make them look more awesome. (Tested with Markdown and LaTeX.)
/*
* I add this to html files generated with pandoc.
*/
html {
font-size: 100%;
overflow-y: scroll;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
@pbnj
pbnj / octant.log
Created August 16, 2019 06:12
octant logs
octant master ↓·4 ✚1 …5 $ OCTANT_LISTENER_ADDR=0.0.0.0:8900 octant -vvv
2019-08-16T06:05:57.259Z DEBUG dash/dash.go:68 Loading configuration: /home/ubuntu/.kube/kind-config-kind
2019-08-16T06:05:57.262Z DEBUG cluster/cluster.go:269 initializing REST client configuration {"client-qps": 200, "client-burst": 400}
2019-08-16T06:05:57.263Z DEBUG cluster/cluster.go:104 created temp directory {"component": "cluster client", "dir": "/tmp/octant626661369"}
2019-08-16T06:05:57.263Z DEBUG dash/dash.go:95 initial namespace for dashboard is default
2019-08-16T06:05:57.267Z DEBUG describer/path_matcher.go:44 register path {"name": "overview", "path": "/"}
2019-08-16T06:05:57.267Z DEBUG describer/path_matcher.go:44 register path {"name": "overview", "path": "/workloads"}
2019-08-16T06:05:57.267Z DEBUG describer/path_matcher.go:44 register path {"name": "overview", "path": "/workloads/cron-jobs"}
2019-08-16T06:05:57.267Z DEBUG describe