Skip to content

Instantly share code, notes, and snippets.

@drbrain
drbrain / git-cleanup-repo
Last active December 3, 2023 08:47 — forked from robmiller/git-cleanup-repo
A script for cleaning up Git repositories. It deletes branches that are fully merged into the origin default branch, prunes obsolete remote tracking branches, and as an added bonus will replicate these changes on the remote.
#!/usr/bin/env nu
# Adapted from original by Yorick Sijsling
# Adapted from bash version by Rob Miller <rob@bigfish.co.uk>
#
# Nushell version
#
# See history for a less-capable bash version
#
# Compared to the fork point this version has additional features:
# * The default branch is automatically discovered (also in prior bash version)
@drbrain
drbrain / unfuck-vmware-net.sh
Created April 7, 2017 04:19 — forked from fnichol/unfuck-vmware-net.sh
"Fix" VMware Network
#!/usr/bin/env bash
set -e
[ -n "$DEBUG" ] && set -x
banner() { printf -- "-----> $*\n"; }
banner "Restarting VMware networking"
banner "Stopping networking"
sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --stop
#!/usr/bin/env ruby
numbers = (1..100).to_a
numbers.each do |n|
div_5 = n.divmod(5).last.zero?
div_7 = n.divmod(7).last.zero?
message =
if div_5 and div_7 then
require "all_your_base"
require "benchmark/ips"
require "minitest/autorun"
require "securerandom"
BASE62_CHARS = [
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o",
"p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D",
"E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S",
@drbrain
drbrain / mygen.rb
Last active December 15, 2015 12:19 — forked from zzak/mygen.rb
require 'rdoc'
class RDoc::Options
attr_accessor :you
attr_accessor :me
end
class MyGen
RDoc::RDoc.add_generator self
@drbrain
drbrain / output
Created October 27, 2011 01:41 — forked from nahi/gist:1318550
buffer size: 1048576, reading 16348