Skip to content

Instantly share code, notes, and snippets.

View nogweii's full-sized avatar
🍀

Nogweii nogweii

🍀
View GitHub Profile
@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 / 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 / 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 / Test.java
Created October 1, 2013 23:39
A quick test to see if you have the JCE Unlimited Strength Jurisdiction Policy files installed. If you don't, in Java 6 you'll see 128. If you do, you'll see 2147483647. Thanks to http://stackoverflow.com/questions/11538746/check-for-jce-unlimited-strength-jurisdiction-policy-files
import javax.crypto.Cipher;
class Test {
public static void main(String[] args) {
try {
System.out.println("Hello World!");
int maxKeyLen = Cipher.getMaxAllowedKeyLength("AES");
System.out.println(maxKeyLen);
} catch (Exception e){
System.out.println("Sad world :(");
@nogweii
nogweii / predictable_cute_hostname.rb
Created October 15, 2013 08:58
Use Frosty Meadow to generate a 'random' name for the server, but first seed Ruby's random with the contents of machine-id. Assumes that /etc/machine-id is valid and exists, and that it contains only hexadecimal numbers. Modify the source to any other source of predictable, guessable machine information. Like the MAC address or similar.
require 'frosty_meadow'
# Use [Frosty Meadow](https://github.com/andyhmltn/frosty-meadow) to generate a
# 'random' name for the server, but first seed Ruby's random with the contents
# of machine-id.
#
# Assumes that /etc/machine-id is valid and exists, and that it contains only
# hexadecimal numbers. Modify the source to any other source of predictable,
# guessable machine information. Like the MAC address or similar.
@nogweii
nogweii / gist:7761427
Created December 3, 2013 00:02
Automatically install -debuginfo packages for all installed packages in OpenSUSE (tested on 13.1)
#!/bin/sh
zypper packages -i 2>/dev/null | cut -d'|' -f3 | sort -u | sed -n 's/^ \([a-z0-9-]*\)\s\+/\1-debuginfo/p' | xargs zypper search -u -t package | cut -d'|' -f2 | sed -n 's/^\s//;s/\s\+$//gp' | tail -n+2 | xargs sudo zypper install
@nogweii
nogweii / pianobar_opensuse_compile.sh
Created December 4, 2013 18:17
what dependencies to install to compile pianobar on OpenSUSE 13.1 & how to make it
sudo zypper install libjson-devel libgcrypt-devel
sudo zypper install libgnutls-devel
# Requires the PackMan repo https://forums.opensuse.org/blogs/caf4926/opensuse-13-1-multi-media-restricted-format-installation-guide-149/
sudo zypper install libmad-devel
sudo zypper install faad2 libfaad-devel
sudo zypper install libao-devel
# Making sure the output driver is pulseaudio
#cat /etc/libao.conf
@nogweii
nogweii / gist:8278021
Last active November 25, 2017 06:34
PageKite configuration for running your own front-end (broken, sorta)
# /etc/pagekite/20_frontend.rc on kites.evaryont.me
# Front-end selection
#
# Front-ends accept incoming requests on your behalf and forward them to
# your PageKite, which in turn forwards them to the actual server.
# Running my own front-end!
isfrontend
@nogweii
nogweii / module_methods.rb
Last active August 29, 2015 13:56
Example module code for #ruby on Freenode
module MyBase
def big_function
@_memoized_big_function ||= begin
load_lots_of_data(SettingsManager.foo_bar)
end
end
module_method :big_function
public :big_function
end
jp2a picture.jpg --colors --invert | head -n20 | sed 's/\^[\[37m \^[\[0m/ /g' > picture.ansi