Skip to content

Instantly share code, notes, and snippets.

@wadey
wadey / iterm2.zsh
Last active March 10, 2024 00:32
Change iTerm2 tab color when using SSH
# Usage:
# source iterm2.zsh
# iTerm2 tab color commands
# https://iterm2.com/documentation-escape-codes.html
if [[ -n "$ITERM_SESSION_ID" ]]; then
tab-color() {
echo -ne "\033]6;1;bg;red;brightness;$1\a"
echo -ne "\033]6;1;bg;green;brightness;$2\a"
@wadey
wadey / twitter-entities.js
Created June 17, 2010 17:50
JavaScript parser for Tweet Entities
/*
* twitter-entities.js
* This function converts a tweet with "entity" metadata
* from plain text to linkified HTML.
*
* See the documentation here: http://dev.twitter.com/pages/tweet_entities
* Basically, add ?include_entities=true to your timeline call
*
* Copyright 2010, Wade Simmons
* Licensed under the MIT license
#!/bin/bash
set -e
FILE="nebula-$(uname | tr '[:upper:]' '[:lower:]')-amd64.tar.gz"
BINDIR="/usr/local/bin"
CURRENT="v$($BINDIR/nebula -version | cut -d' ' -f2)"
TEMPDIR="$(mktemp -d)"
trap 'rm -rf "$TEMPDIR"' exit
#!/bin/sh
VERSION="2.3.0"
SHA="5e2d679"
BUILD="$SHA-slack2"
set -e -x
DIRNAME="$(cd "$(dirname "$0")" && pwd)"
OLDESTPWD="$PWD"
#!/usr/bin/env bash
set -u -e -o pipefail
go list -u -m -json all \
| jq -r 'if (.Indirect | not) and .Update then "\(.Path)\t\(.Version)\t\(.Update.Version)" else "" end' \
| sed -E 's/v[0-9]\.0\.0-[0-9]+-//g' \
| sed -E 's/golang.org\/x\//github.com\/golang\//g' \
| while read -r NAME A B
do
@wadey
wadey / Makefile
Created December 5, 2013 19:14
Makefile for generating Go coverage reports for Jenkins (for projects containing multiple packages)
GO=$(firstword $(subst :, ,$(GOPATH)))
GOCOV=$(GO)/bin/gocov
GOCOVXML=$(GO)/bin/gocov-xml
# List of pkgs for the project
PKGS=$(shell go list ./...)
# Coverage output: coverage/$PKG/coverage.out
COVPKGS=$(addsuffix /coverage.out,$(addprefix coverage/,$(PKGS)))
FORMAT: 1A
## Data Structures
### A
### B
### C
@wadey
wadey / bootstrap.py
Created March 7, 2013 20:53
findi -> postgres
from record_location import Base, engine
msg = 'Warning! This will drop your database. Please confirm:'
shall = True if raw_input("%s (y/N) " % msg).lower() == 'y' else False
if not shall:
print "Cancelled database drop and creation..."
else:
print "Dropping and creating the database..."
Base.metadata.drop_all(engine)
@wadey
wadey / examples.java
Created June 6, 2012 16:53
IntelliJ Templates
// log4j
private static final Logger log = LogManager.getLogger($CLASS_NAME$.class);
@wadey
wadey / webhook.md
Created August 28, 2011 23:13
Botriot WebHooks

Botriot WebHooks

Format

Both the POST data and the expected response data are application/json

POST Request

If a user posts one of the following in the channel: