Skip to content

Instantly share code, notes, and snippets.

@bag-man
bag-man / reflections.md
Last active December 7, 2016 14:53
Agile Reflections

This is an assessed reflection on some workshops that we did for Agile Methodologies

Agile Workshop Reflections

As part of the course we have done three two hour workshops on Agile methodologies. These have been interesting as they have formalised the practises that I had been doing previously in my industrial year.

For example I wasn't aware that pair programming, test driven development, and continuous integration were part of extreme programming, however I had been using them all year. It was also interesting to see that other practices I had been trained in were closely related to the agile manifesto, such as creating and weighting stories, but we weren't following agile in any formal way.

Pair Programming

Pair programming is an excellent tool and from experience of the workshops, personal projects and my industrial year, I can argue that working as a pair is a lot more efficient than working individually. The caveat for this is that both partners are at the same level of familiarisation

@bag-man
bag-man / get_wallpaper.py
Created October 19, 2016 18:36
Select and set a random offensive wallpaper
import praw
import random
import os
from urllib.request import urlretrieve
r = praw.Reddit(user_agent='wallpapergrabber')
submissions = r.get_subreddit('offensive_wallpapers').get_hot()
urls = []
@bag-man
bag-man / database.js
Last active July 22, 2019 22:46
Connect and use MongoDB with ES6 in Node 4
'use strict'
const MongoClient = require('mongodb')
class Database {
constructor (uri) {
this.uri = uri
this.db = {}
return this
@bag-man
bag-man / find-domain-and-port.js
Last active May 20, 2016 11:22
[NodeJS] Evaluate a URL to get it's domain and port, HTTP(s) only
'use strict'
const url = require('url')
function getUrl (dataUrl) {
if (dataUrl.split('://').length === 1 || dataUrl.startsWith('://')) {
dataUrl = `http://${dataUrl.replace('://', '')}`
}
return dataUrl
}
@bag-man
bag-man / Blog.md
Last active May 18, 2016 11:16
ZFS Blog Post

MongoDB Performance on ZFS and Linux

Here at Clock we love ZFS, and have been running it in production on our Linux file servers for several years. It provides us with numerous excellent features, such as snapshotting, incremental send/receive, and transparent compression. With the recent release of Ubuntu Xenial 16.04 official support for ZFS is now here, and we are keen to integrate it fully into our next generation hosting stack.

As a Node.js and MongoDB house, one of our main concerns has been how MongoDB will perform on ZFS on Linux, especially after reading about potential problems other people have faced. There really isn't much data out there to put our minds at rest.

We decided to setup a method of benchmar

@bag-man
bag-man / bench.sh
Last active May 6, 2016 18:07
Benchmark MongDB on different filesystems
formatDrives() {
mkfs.ext4 /dev/sdc
mkfs.xfs /dev/sdd
}
createZFS () {
sleep 30
zpool destroy tank
zpool create -f -m /zfs tank /dev/sde
if [ $1 ]; then
@bag-man
bag-man / fugitive.patch
Created February 11, 2016 13:04
Improve status line formatting in vim-fugitive
index a2cb700..2c44b3d 100644
--- a/plugin/fugitive.vim
+++ b/plugin/fugitive.vim
@@ -3012,7 +3012,7 @@ function! fugitive#statusline(...) abort
if &statusline =~# '%[MRHWY]' && &statusline !~# '%[mrhwy]'
return ',GIT'.status
else
- return '[Git'.status.']'
+ return ' '.status
endif
@bag-man
bag-man / UI-Rules.tex
Last active August 29, 2015 14:21
UI notes
\documentclass[10pt]{article}
\usepackage{a4wide}
\usepackage[english]{babel}
\usepackage{fancyhdr}
\usepackage{hyperref}
\usepackage{lastpage}
\usepackage{graphicx}
\usepackage[section]{placeins}
\usepackage[superscript,biblabel]{cite}
\usepackage[margin=1in]{geometry}
@bag-man
bag-man / quicksort.py
Last active August 29, 2015 14:20
Quicksort
def quicksort(arr):
if not arr:
return []
pivot = arr[-1]
less = [x for x in arr[:-1] if x <= pivot]
more = [x for x in arr[:-1] if x > pivot]
lesser = quicksort(less)
greater = quicksort(more)
# /etc/wpa_supplicant/eduroam.conf
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=root
network={
ssid="eduroam"
scan_ssid=1
key_mgmt=WPA-EAP
eap=TTLS
identity="abc@aber.ac.uk"