Skip to content

Instantly share code, notes, and snippets.

View donfanning's full-sized avatar
🗃️
Holding up libraries and robbing them blind for the future.

Don Fanning donfanning

🗃️
Holding up libraries and robbing them blind for the future.
View GitHub Profile
@donfanning
donfanning / get_zyxel_modem_stats.py
Created July 14, 2020 01:40 — forked from shouptech/get_zyxel_modem_stats.py
A script to query a ZyXEL Q100Z modem and output data in a format usable by Cacti
#!/usr/bin/python
#
# The MIT License (MIT)
#
# Copyright (c) 2014 Mike Shoup
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@donfanning
donfanning / osx-for-hackers.sh
Created September 11, 2019 13:30 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@donfanning
donfanning / osx-for-hackers.sh
Created September 11, 2019 13:30 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@donfanning
donfanning / whatismyip.bash
Created August 20, 2018 01:10 — forked from codatory/whatismyip.bash
WhatIsMyIP Bash Function
whatismyip() {
IP=`curl --silent http://ip.appspot.com/`
echo "External IP: ${IP}"
}
#!/bin/bash
# Mac Bootstrap Script
# (C) 2011 - @codatory
#
# "It might work for you, too."
pretty_echo(){
echo '--------------------------------'
echo " $*"
# Configuration Constants (move to yaml ?)
HOST = 'ad01.domain.local'
PORT = 636
USER = 'administrator'
PASS = 'password'
BASE = 'dc=domain, dc=local'
DOMAIN = 'domain.local'
SCOPE = '(&(objectCategory=person)(objectClass=user))'
require 'rubygems'
@donfanning
donfanning / .tmux.conf
Created August 20, 2018 01:09 — forked from codatory/.tmux.conf
TMUX Conf
# Switch me back to ^A, thanks
set-option -g prefix C-a
unbind-key C-b
bind-key a send-prefix
# I miss ^A^A and ^ASpace
bind-key C-a last-window
bind-key Space next-window
bind-key C-Space previous-window
# Date formats
Time::DATE_FORMATS.merge!(
:friendly_date => lambda {|d| "#{d.month}/#{d.mday}" }, # 4/25 (no leading zeroes)
:friendly_time => lambda {|t|
date = (t.at_midnight == Time.now.at_midnight) ? '' : "#{t.month}/#{t.mday}@" # 4/25@4PM on other days
"#{date}#{t.strftime('%I').to_i}#{t.strftime('%p')}" # 4PM on same day
},
:year => "%Y", # 2008
:month_year => "%b %Y", # Apr 2008
:ampm_time => "%I:%M %p", # 04:15 PM
@donfanning
donfanning / phrase.rb
Created August 20, 2018 01:08 — forked from codatory/phrase.rb
Fuzzy string matching convenience class
require 'fuzzystringmatch'
class Phrase
attr_reader :matches
def initialize(str, match_score=0.8)
@str = str
@matches = []
@match_score = match_score
@scorer = FuzzyStringMatch::JaroWinkler.create
@donfanning
donfanning / fuzzy_match.rb
Created August 20, 2018 01:08 — forked from codatory/fuzzy_match.rb
Fuzzy Matching Library
class FuzzyMatch
class Matcher
require 'singleton'
require 'fuzzystringmatch'
include Singleton
JW = FuzzyStringMatch::JaroWinkler.create
def self.get_score(str1,str2)
JW.getDistance(str1,str2)
end