Skip to content

Instantly share code, notes, and snippets.

View colindean's full-sized avatar
🏆
Helping others find happiness and serenity

Colin Dean colindean

🏆
Helping others find happiness and serenity
View GitHub Profile
@colindean
colindean / afp.conf
Created April 4, 2015 15:59
afp and netatalk config for Time Machine backups
[Global]
uam path = /usr/local/etc/netatalk/uams
max connections = 256
tcprcvbuf = 262144
tcpsndbuf = 262144
server quantum = 262144
zeroconf = yes
guest account = guest
uam list = uams_passwd.so uams_gss.so uams_guest.so uams_dhx2_pam.so
veto files = /.AppleDB/.AppleDouble/.AppleDesktop/:2eDS_Store/Network Trash Folder/Temporary Items/TheVolumeSettingsFolder/.@__thumb/.@__desc/:2e*/.@__qini/.Qsync/.upload_cache/.qsync/.qsync_sn/
sealed trait Angle { val degrees: Int }
private final case object Perpendicular extends Angle { val degrees = 90 }
private final case object Straight extends Angle { val degrees = 180 }
private final case class Acute(degrees: Int) extends Angle
private final case class Obtuse(degrees: Int) extends Angle
private final case class Reflex(degrees: Int) extends Angle
object Angle {
def apply(degrees: Int): Either[String,Angle] = degrees match {
case _ if degrees == 90 ⇒
Right(Perpendicular)
@colindean
colindean / ssh-tester.py
Last active August 29, 2015 14:14
A simple tester of the Secure Secure Shell article recommendations
#!/usr/bin/env python3 -O
import argparse
import subprocess
import sys
def usage():
print("%s target_host target_port" % sys.argv[0])
if len(sys.argv) < 3:
@colindean
colindean / light.rb
Last active August 29, 2015 14:12 — forked from Bunkerbewohner/light
A simple Ruby shell script to control LIFX (http://lifx.co) light bulbs, adds color support
#!/usr/bin/env ruby
require 'lifx'
available_colors = LIFX::Colors.instance_methods
if ARGV.length > 0
# see if a specific lamp is addressed
label = /^on|off|0x[0-9a-f]{6}$/.match(ARGV[0]) || available_colors.member?(ARGV[0]) ? nil : ARGV[0]
@colindean
colindean / displaylink_crunchbang_jessie.md
Last active January 23, 2023 21:25
HOWTO: Use a DisplayLink USB graphics adapter on Crunchbang Linux v11 Waldorf with partial upgrade to Debian Jessie
@colindean
colindean / get_pittmesh_repos.sh
Last active November 6, 2017 20:02
Get all Metamesh and PittMesh repositories
#!/bin/bash
####
#
# This script relies on having these dependencies already installed:
#
# * bash
# * curl
# * jq
# * git
@colindean
colindean / arrayhashset_benchmark.rb
Created November 24, 2014 00:35
A simple benchmark of array v hash v set in Ruby
require 'benchmark'
require 'set'
ranges = [ "a".."z", "A".."Z", 0..9 ]
n = ARGV[0].to_i || 100
Benchmark.bm do |x|
#array
x.report "array" do
n.times do
@colindean
colindean / arrayhashset_benchmark.rb
Created November 24, 2014 00:35
A simple benchmark of array v hash v set in Ruby
require 'benchmark'
require 'set'
ranges = [ "a".."z", "A".."Z", 0..9 ]
n = ARGV[0].to_i || 100
Benchmark.bm do |x|
#array
x.report "array" do
n.times do
@colindean
colindean / phoenix.js
Created November 6, 2014 19:29
My Phoenix config. Use Mjolnir instead.
var mash = ["cmd", "alt", "ctrl"];
var mashShift = ["cmd", "alt", "shift"];
var MARGIN_X = 5;
var MARGIN_Y = 5;
var GRID_WIDTH = 4;
Window.prototype.getGrid = function() {
var winFrame = this.frame();
var screenRect = this.screen().frameWithoutDockOrMenu();
@colindean
colindean / bench_hash.rb
Last active August 29, 2015 14:06
Benchmarking ways to join the key and value of a hash
require 'benchmark'
def h
{"header" => "value", "header2" => "value2"}
end
n = 50_000
Benchmark.bm(20) do |x|
x.report("split interpolation") { n.times {h.collect{|k,v| "#{k}:#{v}"} }}
x.report("split array.join") { n.times {h.collect{|k,v| [k,v].join(':')} }}
x.report("split string cat +") { n.times {h.collect{|k,v| k+':'+v} }}