Skip to content

Instantly share code, notes, and snippets.

View brandondrew's full-sized avatar

Brandon Zylstra brandondrew

  • UC Berkeley
  • the tubes
View GitHub Profile
from scapy.all import *
def arp_display(pkt):
if pkt[ARP].op == 1: #who-has (request)
if pkt[ARP].psrc == '0.0.0.0': # ARP Probe
print "ARP Probe from: " + pkt[ARP].hwsrc
print sniff(prn=arp_display, filter="arp", store=0, count=10)
@jhass
jhass / .rubocop.yml
Last active January 7, 2025 19:23
My preferred Rubocop config
AllCops:
RunRailsCops: true
# Commonly used screens these days easily fit more than 80 characters.
Metrics/LineLength:
Max: 120
# Too short methods lead to extraction of single-use methods, which can make
# the code easier to read (by naming things), but can also clutter the class
Metrics/MethodLength:
@stoft
stoft / orient_connector.ex
Last active December 10, 2015 15:48
Basic OrientDB HTTP/REST backend to Phoenix web framework
defmodule Phtest.OrientConnector do
use Jazz
@base_url "http://localhost:2480/"
@database "Phtest"
@user "admin"
@password "admin"
@basic_auth [basic_auth: {@user, @password}]
def get(document_id, type) do
OrientConnector.get_document(document_id)
@mletterle
mletterle / gist:8048086
Last active November 26, 2021 08:56
Replay Two Git Repositories History Into A New One, Chronologically

Combining Two (or more potentially) Git Repos

###Moving one repo into a subdirectory of the other

Preserves notes and sets commit details to author details

in newrepo

require 'serverspec'
require 'pathname'
require 'net/ssh'
include Serverspec::Helper::Ssh
include Serverspec::Helper::DetectOS
RSpec.configure do |c|
if ENV['ASK_SUDO_PASSWORD']
require 'highline/import'
@datagrok
datagrok / git-serve.md
Last active April 21, 2023 07:33
How to easily launch a temporary one-off git server from any local repository, to enable a peer-to-peer git workflow.
@n1k0
n1k0 / 404checker.js
Created January 11, 2013 10:55
A CasperJS script to check for 404 & 500 internal links on a given website
/**
* This casper scipt checks for 404 internal links for a given root url.
*
* Usage:
*
* $ casperjs 404checker.js http://mysite.tld/
* $ casperjs 404checker.js http://mysite.tld/ --max-depth=42
*/
/*global URI*/
@brandondrew
brandondrew / build_home.sh
Last active December 23, 2021 14:16
Script to automatically build your new home directory on Unix or Linux boxes (with Spartan enhancements)
#!/bin/bash
###############################################################
# BUILD HOME script:
# This script sets up your home directory fast with basic
# necessities and amenities, to give you sanity when you
# work on a Unix box where you don't have root access.
###############################################################
### TO USE:
# wget https://gist.github.com/raw/3639058/build_home.sh
# bash build_home.sh
@paulmillr
paulmillr / type-inference.coffee
Created July 17, 2012 17:39
Damas-Hindley-Milner type inference algorithm in LiveScript
# Algorithm W (Damas-Hindley-Milner) in LiveScript.
# By Paul Miller (paulmillr.com), Public domain.
#
# Based on Robert Smallshire's [Python code](http://bit.ly/bbVmmX).
# Which is based on Andrew's [Scala code](http://bit.ly/aztXwD).
# Which is based on Nikita Borisov's [Perl code](http://bit.ly/myq3uA).
# Which is based on Luca Cardelli's [Modula-2 code](http://bit.ly/Hjpvb).
# Something like that.
prelude = require './prelude'
@mgswolf
mgswolf / rails_template.rb
Created July 11, 2012 18:24
Rails Template
# Application Generator Template
# Modifies a Rails app to use Devise with RSpec and Cucumber
# Usage: rails new APP_NAME -m rails_template.rb -T
# Information and a tutorial:
# https://github.com/RailsApps/rails3-devise-rspec-cucumber
# Generated using the rails_apps_composer gem:
# https://github.com/RailsApps/rails_apps_composer/