Skip to content

Instantly share code, notes, and snippets.

@jeremyje
jeremyje / startup-profile-systemd.sh
Created September 6, 2014 20:09
Startup script for systemd based OSes to profile startup performance.
#!/bin/bash
ID=${RANDOM}
export CLOUDSDK_PYTHON=/usr/bin/python2
systemd-analyze plot > plot.svg
systemd-analyze blame > systemd-analyze-blame.txt
systemd-analyze critical-chain > systemd-analyze-critical-chain.txt
gsutil cp *.txt gs://jeremyje/systemd-debug-${ID}/
gsutil cp *.svg gs://jeremyje/systemd-debug-${ID}/
@jeremyje
jeremyje / run-systemd-arch-profile.sh
Created September 6, 2014 20:11
Creates a VM running Arch Linux to profile systemd startup performance.
#!/bin/bash
INSTANCE_ID=${RANDOM}
INSTANCE_NAME=systemd-arch-profile-${INSTANCE_ID}
ZONE_NAME=us-central1-a
MACHINE_TYPE=f1-micro
echo "Creating Instance, ${INSTANCE_NAME}"
gcloud compute instances create ${INSTANCE_NAME} \
--image arch-v20140906 \
@jeremyje
jeremyje / install-go-gae.sh
Last active March 5, 2016 19:32
Script to Install Go and Go for App Engine on Linux and Cloud 9 IDE
#!/bin/bash
# Script to install Go, Go for App Engine, and Cloud SDK in Linux.
# This script is designed for Cloud 9 IDE but works on regular Linux installs as well.
# All packages are installed in the ${HOME}/development directory.
# If you want to change that simply update the INSTALL_DIR variable.
#
# Usage:
# chmod +x install-go.sh; ./install-go.sh ${PWD}
GO_PROJECT=$1
@jeremyje
jeremyje / install-grpc-go.sh
Created March 8, 2016 04:15
Install gRPC and Protocol Buffers for C++ and Go
#!/bin/bash
sudo apt-get install -y -qq git autoconf automake libtool curl build-essential
mkdir packages
cd packages
git clone https://github.com/google/protobuf.git
cd protobuf
git submodule update --init
./autogen.sh
./configure
@jeremyje
jeremyje / install-kubernetes.sh
Created March 8, 2016 04:28
Install Docker and Kubernetes
#!/bin/bash
sudo apt-get update
sudo apt-get install -y -qq apt-transport-https ca-certificates linux-image-extra-$(uname -r) apparmor
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo echo "deb https://apt.dockerproject.org/repo ubuntu-wily main" > /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get purge -y -qq lxc-docker
sudo apt-cache policy docker-engine
sudo apt-get install docker-engine
@jeremyje
jeremyje / install-glide.sh
Last active July 3, 2016 08:17
Install glide
#!/bin/bash
# curl https://gist.githubusercontent.com/jeremyje/222919f7b3d0277b86887a7d0694001a/raw/install-glide.sh | bash 2>&1 | tee output.txt
VERSION=0.10.2
FILENAME=glide-${VERSION}-linux-amd64.tar.gz
wget https://github.com/Masterminds/glide/releases/download/${VERSION}/${FILENAME}
tar xvzf ${FILENAME}
mv linux-amd64/glide .
rm -rf linux-amd64
rm ${FILENAME}
#!/bin/bash
# curl https://gist.githubusercontent.com/jeremyje/6b4cb25cdfe6fe09e13d441428e63c59/raw/install-go.sh | bash
# https://golang.org/dl/
LATEST_GO_VERSION=1.13.1
PrepareInstallation() {
mkdir -p packages
cd packages
sudo apt-get -qq -y update
sudo apt-get -qq -y install cmake build-essential git autoconf automake \
libtool curl build-essential
@jeremyje
jeremyje / trusty-snappy.sh
Last active July 9, 2016 02:15
Install Snapcraft on Ubuntu Snappy
#!/bin/bash
# curl https://gist.githubusercontent.com/jeremyje/63feaff90dfcab6cfa70336f7a61ff7e/raw/trusty-snappy.sh | bash
sudo apt-add-repository ppa:snappy-dev/tools
sudo apt update
sudo apt-get install -y -q snappy-tools
sudo apt install -y -q snapcraft
@jeremyje
jeremyje / go-vendor.sh
Created July 11, 2016 16:30
Go vendoring shell script. Adds a proper git submodule for the dependency from head, does not do proper versioning because that's how I roll.
#!/bin/bash
GO_DIR=$(pwd)
echo ${GO_DIR}
GitClone() {
BASE_DIR=vendor/$1
REPO=$2
echo ${GO_DIR}
cd ${GO_DIR}
git submodule add ${REPO} ${BASE_DIR}
cd ${GO_DIR}
@jeremyje
jeremyje / README.md
Last active July 25, 2016 06:38
Build all of Prometheus Binaries from HEAD

Setup the workspace

export GOPATH=${PWD}
mkdir -p src/github.com/prometheus/
cd src/github.com/prometheus/

./download.sh