Skip to content

Instantly share code, notes, and snippets.

View alexblackie's full-sized avatar

Alex Blackie alexblackie

View GitHub Profile
@alexblackie
alexblackie / cloc-per-directory.rb
Last active May 31, 2021 17:20
cloc stats per directory
require 'csv'
require 'json'
# Generate stats.csv with `cloc`:
#
# cloc --csv --by-file --report-file stats.csv .
# CSV row:
# language,filename,blank,comment,code,version
@alexblackie
alexblackie / userChrome.css
Last active April 27, 2018 14:14
Improve spacing and padding in Firefox 60 CSD in GNOME
/**
** Usage:
* 1. Create "$HOME/.mozilla/firefox/*.default/chrome/" if it doesn't exist
* 2. Place this stylesheet as: $HOME/.mozilla/firefox/*.default/chrome/userChrome.css
* 3. Restart Firefox.
*/
#TabsToolbar {
--space-above-tabbar: 10px;
}
@alexblackie
alexblackie / transcode.rb
Last active February 20, 2018 02:21
This is how I manage my music library. SHA256 hashes as filenames, transcoded to MP3@320K, is what gets distributed to my phones, laptops, etc. FLAC/MP3 masters get left on the NAS.
# vim: ts=4 sw=4 noexpandtab
require "digest"
require "fileutils"
class Transcoder
CONCURRENCY = 8.freeze
DEFAULT_OUTPUT_DIR = File.join(File.dirname(__FILE__), "..", "mp3s").freeze
MANIFEST_FILE = ".transcode.manifest".freeze
MANIFEST_DELIMITER = "||".freeze
mkdir softwarez ; cd softwarez
rpm --root `pwd` --initdb
dnf download --destdir=var/tmp fedora-release
sudo rpm --root `pwd` -ih --nodeps var/tmp/fedora-release-25-1.noarch.rpm
sudo dnf install --installroot=`pwd` -y vim
./usr/bin/vim
@alexblackie
alexblackie / putty.ini
Last active June 9, 2016 01:49
Sane defaults for Putty
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\SimonTatham\PuTTY\Sessions\Default%20Settings]
"UserName"="alex"
"FullScreenOnAltEnter"=dword:00000001
"Beep"=dword:00000000
"BeepInd"=dword:00000000
"TermWidth"=dword:00000096
"TermHeight"=dword:00000028
"Font"="Consolas"

Keybase proof

I hereby claim:

  • I am alexblackie on github.
  • I am alexblackie (https://keybase.io/alexblackie) on keybase.
  • I have a public key whose fingerprint is 62C5 2F68 3634 47D9 71C6 29ED A231 E0F2 D35D 0D47

To claim this, I am signing this object:

@alexblackie
alexblackie / bucket_policy.json
Created March 25, 2016 18:26
Allow public read for everyone on an AWS bucket
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
@alexblackie
alexblackie / system.pa.diff
Created March 18, 2016 05:42
Closest I could get to completely disabling ducking in Pulseaudio on Fedora 23 (GNOME) -- `git diff /etc/pulse/system.pa ~/.config/pulse/system.pa`
diff --git a/etc/pulse/system.pa b/home/alex/.config/pulse/system.pa
index 903aa39..92b10f7 100644
--- a/etc/pulse/system.pa
+++ b/home/alex/.config/pulse/system.pa
@@ -54,3 +54,7 @@ load-module module-suspend-on-idle
### Enable positioned event sounds
load-module module-position-event-sounds
+
+### FUCK YOUR FUCKING DUCKING ###
@alexblackie
alexblackie / db_object_serialiser.erl
Created March 10, 2016 20:34
make maps from an epgsql query result
-module(db_object_serialiser).
-include_lib("eunit/include/eunit.hrl").
-export([serialise/2]).
serialise(Columns, Datas) ->
Keys = lists:map(fun(Col) ->
element(2, Col)
end, Columns),
lists:map(fun(Val) ->
lists:foldl(fun(K, Acc2) ->
#!/bin/sh
#####################################
# Getting cmus running on Fedora 23 #
#####################################
# Get the things
git clone https://github.com/cmus/cmus.git && cd cmus
# Install required headers