Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View cronnelly's full-sized avatar

Michael Cronnelly cronnelly

View GitHub Profile
@cronnelly
cronnelly / gist:8382688
Created January 12, 2014 09:39
A crude test for UDP packet loss, with bash and netcat
# On server:
COUNT=0; while true; do nc -ulw0 1234 > /dev/null; echo $((++COUNT)); done
# On client:
for i in $(seq 6000); do echo "hello" >/dev/udp/<server>/1234; sleep 0.1; done
@cronnelly
cronnelly / zram
Created November 25, 2012 14:42
A munin plugin to graph zram usage
#!/bin/bash
# -*- sh -*-
: << =cut
=head1 NAME
zram - Plugin to monitor zram usage
=head1 CONFIGURATION

Keybase proof

I hereby claim:

  • I am cronnelly on github.
  • I am cronnelly (https://keybase.io/cronnelly) on keybase.
  • I have a public key ASC0iYpOGQVtE8DWLyW1ukBW-u2x2KuU9207CigbYFhTvAo

To claim this, I am signing this object:

@cronnelly
cronnelly / -
Created December 13, 2017 22:06
test
@cronnelly
cronnelly / install_ffmpeg.sh
Last active October 26, 2016 07:24 — forked from smac89/install_ffmpeg.sh
Install latest version of ffmpeg on Ubuntu
#!/bin/bash
sudo apt-get update
sudo apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev \
libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev \
libxcb-xfixes0-dev pkg-config texinfo zlib1g-dev
# Create a dir where the rest of the sources will live
mkdir ~/ffmpeg_sources
@cronnelly
cronnelly / gist:98345100afe21840267270da3283b371
Created April 5, 2016 18:00
lxcbr0 is being replaced by lxdbr0
┌─────────────────────────────────────────────────────────┤ Configuring lxd ├──────────────────────────────────────────────────────────┐
│ │
│ lxcbr0 is being replaced by lxdbr0 │
│ │
│ With this package upgrade LXD is moving away from the LXC provided lxcbr0 bridge and moving to its own lxdbr0 bridge. │
│ │
│ The reason for this switch is:
# Fix PuTTY's bad ACS handling in Unicode
set-option -ga terminal-overrides ',*:enacs@:smacs@:rmacs@:acsc@'
# Start from 1
set -g pane-base-index 1
set -g base-index 1
# Colours
set-option -g default-terminal screen-256color
@cronnelly
cronnelly / node-upstart-template.conf
Last active December 17, 2015 17:09
Template Upstart script for Clock's Node.js applications, using nave.
author "Michael Cronnelly"
env NODE_ENV=testing
env NODE_START=/var/application/<site>/server.js
env NODE_VERSION=0.10.7
env PORT=3310
setuid node
env HOME=/home/node
@cronnelly
cronnelly / multi-tail-filter.sh
Created March 30, 2013 19:00
Tail and filter log files on multiple SSH hosts.
for i in $(seq 2); do ssh -A sl-shortlist-0$i "tail -f /var/log/apache2/other_vhosts_access.log | cut -f 4,5,6,7,8,13 | awk -F'=' '{if (\$NF > 500000) print \"$i:\", \$0; fflush()}'" & true; done | cat
@cronnelly
cronnelly / screen_serve.sh
Created October 25, 2012 13:32
Serve X display snapshot over HTTP
#!/bin/bash
# Call from inet with this config:
# www stream tcp nowait node /usr/local/bin/screen_serve.sh
export XAUTHORITY=/home/node/.Xauthority
export DISPLAY=:0
filename="/tmp/screen-"$(uuidgen)".jpg"
for i in `seq 100`; do