Skip to content

Instantly share code, notes, and snippets.

@ianlevesque
ianlevesque / prouting.sh
Last active February 27, 2018 08:40 — forked from oskar456/prouting.sh
A simple script to set up policy routing on linux. It's stateless and detects everything automatically, so all you have to do is to run it after every network subsystem change. I run it in postup and postdown hooks in Gentoo network configuration file.
#!/bin/bash
IP="/sbin/ip"
function prepare_rt_table() {
local rttables=/etc/iproute2/rt_tables
local iface=$1
[[ "${iface}" = 'lo' ]] && return
if ! egrep -q "\s${iface}\s*"\$ $rttables; then
idx=$(wc -l <$rttables)
@ianlevesque
ianlevesque / pwned.rb
Created February 22, 2018 03:37 — forked from marshallmick007/pwned.rb
Check an entire list of passwords against the Pwned Passwords V2 API
#!/usr/bin/env ruby
require 'io/console'
require 'open-uri'
require 'digest'
IO.foreach("passwords.txt") do |line|
password = line.strip
hash = Digest::SHA1.hexdigest(password).upcase
prefix = hash[0...5]
@ianlevesque
ianlevesque / capmon.rb
Created August 31, 2011 21:17 — forked from amscotti/capmon.rb
Ruby script to retrieve and display Comcast data usage. See http://www.128bitstudios.com/2011/08/27/comcast-data-usage-put-a-fork-in-it/
#!/usr/bin/env ruby
require 'rubygems'
require 'mechanize'
URL_PRELOADER = 'https://customer.comcast.com/Secure/Preload.aspx?backTo=%2fSecure%2fUsers.aspx&preload=true'
URL_USERS = 'https://customer.comcast.com/Secure/Users.aspx'
URL_ACCOUNT = 'https://customer.comcast.com/Secure/Account.aspx'
abort "Usage: #{$0} <username> <password>" unless ARGV.length == 2