Skip to content

Instantly share code, notes, and snippets.

@jessehub
jessehub / condawrap.sh
Last active August 23, 2019 16:17
Create exec-wrapper for the active conda python environment
#!/bin/sh
# Environment name (ENVNAME) wrapper creator, allowing for execution within that python virtual environ
# invoking as eg: ~/ENVNAME/run-in <command> [<args>]
# Requires https://github.com/gqmelo/exec-wrappers
PYTHONPATH=`which python`
BINDIR=`dirname $PYTHONPATH`

Keybase proof

I hereby claim:

  • I am jessehub on github.
  • I am jessecallaway (https://keybase.io/jessecallaway) on keybase.
  • I have a public key ASDly7gC7hVtUDmrqjb4kmjggQuXOIvU3xEaoOVoFHWPDAo

To claim this, I am signing this object:

provider "aws"{
region = "us-east-1"
}
data "aws_ami_ids" "ubuntu18-hvm" {
owners = ["099720109477"]
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-*"]
@jessehub
jessehub / der.py
Created March 9, 2017 19:36
snapshot lambda
import boto3
import json
import datetime
def respond(err, res=None):
return {
'statusCode': '400' if err else '200',
'body': err.message if err else json.dumps(res, default=str),
'headers': {
'Content-Type': 'application/json',
cat ~/.kitchen/config.yml
---
driver:
<% docker=`docker-machine env default`.match(/DOCKER_HOST="(.+)"/) %>
<% if docker %>
name: docker
socket: <%= docker[1] %>
<% elsif ! `which vagrant`.empty? %>
name: vagrant
<% end %>
@jessehub
jessehub / get_port
Created November 17, 2015 18:27
get next available listening TCP4 port in a range, works with linux netstat and gnu awk
#!/bin/bash
if [[ $# -ne 2 ]]; then
echo "Usage: $0 start end"
exit 1
fi
start=$1
end=$2
@jessehub
jessehub / wcbroom.pl
Last active December 12, 2015 10:09
Helper for sorting out a lot of changes in between your repo and wc in svn. Triage before you start merging.
#!/usr/bin/perl
foreach (`svn status`) {
chomp;
/^(.)\s+(.*)$/;
($status, $file) = ($1, $2);
print "[$status]\t'$file'\n";
if ($status eq '?') {
newfile($file);
<?php
function whatis($variable) {
if (gettype($variable) != 'object') {
if (gettype($variable) == 'array') {
foreach ($variable as $k => $v) {
$str .= "['$k']=>'$v' ,";
}
return 'Array ['.$str.']';
}