Skip to content

Instantly share code, notes, and snippets.

@dctrwatson
dctrwatson / nginx.conf
Last active April 28, 2024 10:26
Caching PyPi packages locally with nginx
user www-data;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@dctrwatson
dctrwatson / nginx.conf
Last active April 28, 2024 10:23
Caching NPM proxy using Nginx
user www-data;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@dctrwatson
dctrwatson / etc.network.interfaces
Created September 14, 2012 09:11
Multi vip ucarp on single interface
auto eth0
iface eth0 inet static
address 10.0.1.2
netmask 255.255.255.0
up /../ucarp_up_down.sh
down /../ucarp_up_down.sh
ucarp-vid-0 3
ucarp-vip-0 10.0.1.3
ucarp-password-0 badpasswd
ucarp-vid-1 10
@dctrwatson
dctrwatson / commit_diff.sh
Last active April 9, 2024 20:50
Update Phabricator diff depending on build status
BASE_COMMIT=$(echo {\"diff_id\": ${DIFF_ID}} | arc call-conduit differential.getdiff | awk -v RS=',' -v FS=':' '$1~/\"sourceControlBaseRevision\"/ {print $2}' | tr -d \")
# Update repo (can be taken care of by jenkins too)
git fetch --all
git remote prune origin
# We only want to test the diff so reset to base
git reset --hard ${BASE_COMMIT}
git clean -fdx
@dctrwatson
dctrwatson / update_integration_test_apps.py
Created August 7, 2013 02:56
Update jenkins matrix build with config per python app
import os
import re
import urllib
from lxml import etree
JENKINS_CONIG_URL = 'http://jenkins.local/job/integration-tests/config.xml'
BLACKLIST = set(('tests/integration/app1', 'tests/integration/app2', ))
def remove_root_from(path):
@dctrwatson
dctrwatson / clean-cilium-state.sh
Created April 25, 2020 05:36
Clean up cilium bpf programs
#!/usr/bin/env bash
if [[ "${EUID}" -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
while read -r cgroup_json; do
cgroup="$(jq -r .cgroup <<<"${cgroup_json}")"
# Don't want to detach systemd programs. Cilium attaches its program at the root and under docker.
@dctrwatson
dctrwatson / JenkinsDiffEventListener.php
Last active January 11, 2020 22:56
Jenkins Phabricator Inegration
<?php
/*
* Copyright 2013 Disqus, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
set runtimepath+=$GOROOT/misc/vim
set runtimepath+=$HOME/gocode/src/github.com/golang/lint/misc/vim
" Enable filetype plugin
filetype on
filetype plugin on
filetype plugin indent on
syntax on " Syntax highlighting
@dctrwatson
dctrwatson / README.md
Last active June 21, 2019 23:51
Open Network Config for Mullvad OpenVPN

Natively connect to Mullvad OpenVPN servers with ChromeOS.

Usage

  1. Download the example ONC file
  2. Open the file with Text and update Username with your account number
  3. Open chrome://net-internals/#chromeos
  4. Import the ONC file

Tip

@dctrwatson
dctrwatson / gist:7206322
Last active February 12, 2018 14:30
Jank way to use instance storage automatically in EC2
#cloud-config
mounts:
- [ ephemeral0, /var, ext4, "defaults,noatime", "0", "2" ]
- [ swap, null ]
bootcmd:
- mkdir -p /tmp/root
- mount --bind / /tmp/root
- rsync -aq /tmp/root/var/lib/cloud /var/lib/