Skip to content

Instantly share code, notes, and snippets.

View pjones's full-sized avatar
🏠
Working from home

Peter J. Jones pjones

🏠
Working from home
View GitHub Profile

Equifax Data Breach

Computer security is a "hobby" of mine so I want to make sure the people I care about understand the gravity of the Equifax data breach and how to respond.

What you should know

Back in July, criminals broke into Equifax's computers and stole information on at least 143 million Americans (the U.S. population is

@pjones
pjones / autosshfs.nix
Created March 28, 2017 19:20
autofs + sshfs NixOS module.
# Configure autofs for mounting sshfs mounts as a specific user.
#
# Heavily inspired by https://github.com/hellekin/autosshfs
{ config, pkgs, lib, ...}: with lib;
let
cfg = config.pjones.services.autosshfs;
mkdir = "${pkgs.coreutils}/bin/mkdir";
##############################################################################
services.compton = {
enable = true;
package = pkgs.compton-git;
fade = true;
fadeDelta = 5;
activeOpacity = "1.0";
inactiveOpacity = "0.92";
menuOpacity = "1.0";
shadow = false;
extraOptions = ''
let
pkgs = import <nixpkgs> {};
stdenv = pkgs.stdenv;
mysql = pkgs.mysql55;
in rec {
cltc-claims = stdenv.mkDerivation rec {
name = "cltc-claims";
version = "0.0";
src = ./.;
@pjones
pjones / sno.rb
Created November 18, 2015 19:54
The new safe navigation operator in Ruby 2.3
#!/usr/bin/env ruby
################################################################################
#
# Watch out for the unusual argument evaluation rules with the new
# safe navigation operator in Ruby 2.3.
#
# It short circuits just like the logic operators. This is different
# than how the `try' method works in ActiveSupport.
#
@pjones
pjones / convert.rb
Last active August 29, 2015 14:26
Read a tab-separated file generated by PasswordSafe and use the pass(1) tool to record new passwords.
#!/usr/bin/env ruby
################################################################################
# Read a tab-separated file generated by PasswordSafe and use the
# pass(1) tool to record new passwords.
#
# To use this script:
#
# 1. Create and mount an encrypted disk image (cryptsetup).
#
#!/bin/sh -e
################################################################################
# This is a simple wrapper around cabal to build Haskell projects.
echo $NIX_GHC
################################################################################
# Keep cabal from being affected by local configuration.
export HOME="$(mktemp -d)"
@pjones
pjones / class_counter.rb
Created May 26, 2015 19:28
Counting classes created with `Class.new`
#!/usr/bin/env ruby
# Don't use this in production!
module ClassCounter
def self.extended (klass)
$stderr.puts("Injecting hacked `new' into `#{klass}'")
klass.instance_exec {@klass_count = 0}
end
def new (*)
class Version
attr_reader(:major, :minor, :patch)
def initialize (version)
@major, @minor, @patch =
version.split('.').map(&:to_i)
end
def <=> (other)
return nil unless other.is_a?(Version)
#!/bin/sh
whatisthere () {
for dir in `echo $PATH | sed 's/:/ /g'`; do
for file in $dir/*; do
base=`basename $file`
desc=`whatis $base 2>&1`
[ $? -eq 0 ] && echo $desc
done
done