Skip to content

Instantly share code, notes, and snippets.

View kentbrew's full-sized avatar

Kent Brewster kentbrew

View GitHub Profile
@kentbrew
kentbrew / pinmarklet.md
Last active April 9, 2024 18:34
How to recreate your long-lost Pinterest bookmarklet.

How to recreate your long-lost Pinterest bookmarklet.

Right-click your bookmarks bar and choose Add Page (Chrome) or New Bookmarklet (Firefox).

In Name, put this:

Pin It

In URL, put this:

@kentbrew
kentbrew / konami.md
Last active April 18, 2016 20:16
Problem-Solving Interview Question: Implementing the Konami Code

#Implementing the Konami Code

The Konami Code is a cheat code that appears in many early Konami video games. During the title screen before the game demo begins, the player can press the following sequence of buttons on the game controller to enable the cheat:

###↑ ↑ ↓ ↓ ← → ← → B A [Start]

The code has also found a place in popular culture as a reference to the third generation of video game consoles, and is present as an Easter egg on a number of Web sites.

####Please implement the Konami Code in JavaScript.

@kentbrew
kentbrew / hashy.js
Created February 2, 2016 17:05
A simple Slack bot that returns digests for popular cryptographic hash functions.
/*
To make Hashy work, you'll need to install Botkit and follow instructions here:
https://github.com/howdyai/botkit
Success looks like this:
@hashy sha1 foo
sha1 hash of `foo`:
0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33

Converting Clamcoin to Dogecoin

If you had a Dogecoin address containing at least one coin before May 10th 2014, a copy of the address was created and awarded with 4.6055 Clam.

With the recent drop in Bitcoin, those Clams were suddenly worth messing with.

I had four addresses with nonzero balances on that fine day; I've just converted them to Dogecoin, doubling my tiny stash!

Here's what worked for me:

@kentbrew
kentbrew / glint.html
Created June 13, 2015 16:39
Glint 1.0: a single-page puzzle game straight outta 1994. See me run on http://tilde.club/~kentbrew/glint.html
<!doctype html>
<html>
<head>
<title>Glint 1.0</title>
<style>
body {
font-family: monospace;
}
</style>
</head>
@kentbrew
kentbrew / abandon_all_hope.md
Last active April 22, 2018 06:17
Signing a Self-Hosted Auto-Updating Firefox Extension under the New Regime

Signing a Self-Hosted Auto-Updating Firefox Extension under the New Regime

I run a self-hosted auto-updating Firefox add-on being used by several million people. I am informed that I will need to "sign" it soon or it will quit working. (Deadlines are unclear; it seems like it may be as soon as June 30th.) I am looking for exact instructions as to how to make this happen.

I am not finding these instructions, so I am doing my best to puzzle things out.

Googling for things like "how to sign a firefox add-on" get me a lot of false leads. Mozilla should take down or at least modify these pages with current information:

https://developer.mozilla.org/en-US/docs/Signing_a_XPI

https://developer.mozilla.org/en-US/docs/Signing_an_extension

<!doctype html>
<html>
<head>
<title>What / Where</title>
<meta charset="UTF-8">
<style>
body {
font-family: Verdana;
text-align: center;
}
@kentbrew
kentbrew / outen_the_light.md
Created December 3, 2014 17:34
How to Quickly Turn Off the Flashlight on your Locked iPhone

How to Quickly Turn Off the Flashlight on your Locked iPhone

IOS6 introduced the super-handy native flashlight. During the winter months I use this every night after work, when I go out back and see if the hens have laid any eggs.

With the migration of the iPhone's power button down from the top of the device and into a place where I accidentally hit it pretty much every fucking time I pick the fucking thing up, turning the flashlight off has become a serious pain in the ass. "Whoops, you powered the phone off. Press the Home button, slide to unlock, enter your password, swipe up from the bottom, and tap the flashlight-shaped thing." This is hard to do one-handed or while carrying an egg or two, so I wind up sticking the phone in my pocket with the light on.

Today I learned that since my camera is available from my iPhone lock screen, all I need to do is hit the power button again and swipe up from the camera icon in the bottom right corner. As soon as the camera app starts, the flashlight turns of

@kentbrew
kentbrew / plonkify.txt
Last active August 29, 2015 14:09
The beginnings of a Twitter plonk list.
113137765 TheRalphRetort
6160792 Nero
358545917 PlayDangerously
816532555 FartToContinue
2275538935 RogueStarGamez
83339474 _icze4r
2764897681 RealVivianJames
2353828890 woundedhussar
@kentbrew
kentbrew / glint.html
Last active August 29, 2015 14:07
Glint 1.0
<!doctype html>
<html>
<head>
<title>Glint 1.0</title>
<style>
body {
font-family: monospace;
}
</style>
</head>