Skip to content

Instantly share code, notes, and snippets.

View nogweii's full-sized avatar
🍀

Nogweii nogweii

🍀
View GitHub Profile
@nogweii
nogweii / dialog_ip.sh
Created August 19, 2013 23:09
Converts a single, physical interface into 2 virtual vlans that can route to each other. There is no need for a second physical interface or cable.
#!/bin/sh
#
###############################################################################
# Magical Single-Interface Routing Script (MSIRS)
#
# Converts a single, physical interface to 2 separate vlans that can route to
# each other. There is no need for a second physical interface or cable.
# However, since you are not literally in the middle of every packet, there is
# still a chance of an internal computer being connected to directly. It's
# unlikely, but because of this risk you should not run this in a production
@nogweii
nogweii / massage_data.rb
Last active December 16, 2015 22:39
Code I used to convert Stack Overflow's 2012 survey responses (available as an XLSX) to some numerics ready for statistical analysis
#!/usr/bin/ruby
# The StackOverflow data set is available as an XLSX (Microsoft 2007+ Excel
# Spreadsheet) file, which means that most readers will 'helpfully' convert the
# data into various formats.
#
# Also, the data itself is presented as a range of numbers, and for my
# statistical analysis I'm using simple numbers, so I take the mean of the
# range.
@nogweii
nogweii / metaflac.list.txt
Created March 14, 2013 08:16
Output from running `metaflac --list *.flac` on the Symphony of Science album, to try fixing https://github.com/sampsyo/beets/issues/220#issuecomment-14890379
This file has been truncated, but you can view the full file.
01-Our Story (intro).flac:METADATA block #0
01-Our Story (intro).flac: type: 0 (STREAMINFO)
01-Our Story (intro).flac: is last: false
01-Our Story (intro).flac: length: 34
01-Our Story (intro).flac: minimum blocksize: 4096 samples
01-Our Story (intro).flac: maximum blocksize: 4096 samples
01-Our Story (intro).flac: minimum framesize: 362 bytes
01-Our Story (intro).flac: maximum framesize: 14413 bytes
01-Our Story (intro).flac: sample_rate: 44100 Hz
01-Our Story (intro).flac: channels: 2
@nogweii
nogweii / truthy.pp
Created January 10, 2013 17:00
A few tests of puppet's truthy behaviour
$ puppet apply truthy.pp
"0" is truthy!
/Stage[main]//Notify["0" is truthy!]/message: defined 'message' as '"0" is truthy!'
1 is truthy!
/Stage[main]//Notify[1 is truthy!]/message: defined 'message' as '1 is truthy!'
0 is truthy!
/Stage[main]//Notify[0 is truthy!]/message: defined 'message' as '0 is truthy!'
Finished catalog run in 0.17 seconds
@nogweii
nogweii / color_scheme.yaml
Last active February 20, 2023 17:54
The current color scheme I use in my gnome terminal, plus accompanying ruby script which generated it
---
:blue: "#3465A4"
:cyan: "#06989A"
:green: "#4E9A06"
:bright_red: "#EF2929"
:bright_yellow: "#FCE94F"
:bright_purple: "#AD7FA8"
:bright_white: "#EEEEEC"
:red: "#CC0000"
:yellow: "#C4A000"
@nogweii
nogweii / wget_measure_speed.sh
Created May 13, 2012 17:12
A script that will measure how fast, over time, a file was downloaded (CSV)
wget http://URL/BIG_FILE -O/dev/null 2>&1 1>/dev/null | awk '/^ / { speed=$8 } /^\d/ { speed = $7 } { if (NR % 500 == 0) { print "\n" } if (index($speed, "M")) { print substr($speed, 1, index($speed, "M")-1)*1024 } else if (index($speed, "K")) { print substr($speed, 1, index($speed, "K")-1) } else { print 0 } }' | tr '\n' ',' | sed "s/,,/\n/g;s/^,//" > speeds.csv
@nogweii
nogweii / sysctl.changed.conf
Created February 22, 2012 20:30
A massive collection of various sysctl files, designed for drop-in CCDC fixing
fs.file-max = 65535
fs.inode-max = 32768
fs.suid_dumpable = 0
kernel.core_uses_pid = 1
kernel.exec-shield = 1
kernel.maps_protect = 1
kernel.msgmax = 65536
kernel.msgmnb = 65536
kernel.panic = 30
kernel.panic_on_oops = 30
@nogweii
nogweii / .gitconfig
Created September 14, 2011 06:52
Alternative to installing hub for git, kinda.
[url "ssh://[email protected]/"]
; What to substitute when pushing
pushInsteadOf = gh:
; What to substitute when pulling/cloning
insteadOf = gh:
; Inspired by KDE's config.
@nogweii
nogweii / imgfave.rb
Created July 10, 2010 22:19
Simple CLI client for imgfave.
#!/usr/bin/ruby
# A simple CLI client to save images to imgfave.com
# It's kind of like an undocumented API but that doesn't matter so much, right?
# They've hit inertia beyond what they can easily manage. This so-called 'API'
# will be available for a good while anyways.
require 'net/http'
# 3 parameters passed.
@nogweii
nogweii / PKGBUILD.sh
Created May 19, 2010 00:03
PKGBUILD for jabberd2
# Maintainer: Gaetan Bisson <[email protected]>
# Edited by Colin Shea <[email protected]>
# ---
# Remember to remove the `.sh' from the filename. it's there to help Gist
# syntax highlight this whole shebang.
#
# See my blog post for more info: http://mindtables.heroku.com/2010/05/18/compiling-jabberd-2-on-arch/
pkgname=jabberd2
pkgver=2.2.9