Skip to content

Instantly share code, notes, and snippets.

View benmathes's full-sized avatar

Ben Mathes benmathes

View GitHub Profile
@benmathes
benmathes / dice_converter.rb
Last active December 8, 2022 10:45
n-sided dice to m-sided dice
# rand(n) is a random number 0-(n-1)
# e.g. [1,0,0] => 4
def bit_array_to_integer(bit_array)
return bit_array.join.to_i(2)
end
@benmathes
benmathes / gist:1ed7c90934df0bd21774
Last active January 5, 2016 17:27
Unsolicited Thoughts for the Young Men of San Francisco
The sooner you’re comfortable dressing up to look like you didn't try that hard to look cool, the better.
If your friends aren’t surprised by one of your political affiliations then you’re too predictable.
If you're not already, become friends with a housing-rights activist.
Know enough about wine that you’re comfortable speak to a sommelier.
Know enough about weed that you're comfortable talking to the truffle guy in Dolores Park.
Don't learn to drive a stick shift on the SF hills.
Don’t frequent strip clubs.
Pay for her Uber home.
The best articles on twitter are not from news outlets.
Never wear activewear outside The Marina or Cow Hollow unless you are actually exercising or on your way to.
@benmathes
benmathes / gist:20c57e0487cb9c9db2f3
Created January 5, 2016 17:09
Guide to San Francisco
The sooner you’re comfortable dressing up to look like you didn't try that hard to look cool, the better.
If you’re friends aren’t surprised by one of your political affiliations then you’re too predictable.
If you’re not already, become friends with a housing-rights activist.
Know enough about wine that you’re comfortable speak to a sommelier.
Know enough about weed that you're comfortable talking to the truffle guy in Dolores Park.
Don't drive a stick shift.
Don’t frequent strip clubs.
If you’re useful in the kitchen you might be able to make rent.
Pay for her Uber home.
That’s not a beanie is it?
Verifying that +benmathes is my openname (Bitcoin username). https://onename.io/benmathes

Keybase proof

I hereby claim:

  • I am benmathes on github.
  • I am bmath (https://keybase.io/bmath) on keybase.
  • I have a public key whose fingerprint is 8683 60B4 3984 CAFC 7C74 0864 D4A3 2DBF 9C2C DAC8

To claim this, I am signing this object:

@benmathes
benmathes / gist:7151836
Created October 25, 2013 09:06
Speed up your time on the command line
# first, find out which commands you use the most:
cut -f1 -d" " ~/.bash_history | sort | uniq -c | sort -nr | head -n 30
# example output:
95 cd
63 bundle
40 exit
@benmathes
benmathes / bye_bye_battletoads
Created February 28, 2013 22:06
Outgoing Groupon CEO's statement, wherein he references Battletoads and wins my heart.
Full text of his statement:
(This is for Groupon employees, but I’m posting it publicly since it will leak anyway)
People of Groupon,
After four and a half intense and wonderful years as CEO of Groupon, I’ve decided that I’d
like to spend more time with my family. Just kidding – I was fired today. If you’re wondering
why… you haven’t been paying attention. From controversial metrics in our S1 to our material
weakness to two quarters of missing our own expectations and a stock price that’s hovering
around one quarter of our listing price, the events of the last year and a half speak for