Skip to content

Instantly share code, notes, and snippets.

View simeonwillbanks's full-sized avatar
☀️
😎

Simeon Willbanks simeonwillbanks

☀️
😎
View GitHub Profile
@offirgolan
offirgolan / unwatch-gh-org.js
Created August 2, 2017 05:57
Unwatch All Org Repos
// Navigate to https://github.com/watching and then run:
// Taken from: https://stackoverflow.com/questions/11043374/how-to-unwatch-multiple-repos-easily-on-github
Array.prototype
.slice.apply(document.querySelectorAll('.js-subscription-row'))
.forEach(el => { const org = el.querySelector('a[href^="/YOUR_ORG"]'); if (org) el.querySelector('button').click()});

Scaling your API with rate limiters

The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.

In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.

Request rate limiter

This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.

@evandrojr
evandrojr / ruby.json
Created March 28, 2017 17:50
Debug with pry in VSCODE
{
// Place your snippets for Ruby here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Debug with pry": {
"prefix": "pry",
"body": [
@iscott
iscott / simple_authentication_rails_5_bcrypt_and_has_secure_password.md
Last active March 15, 2024 03:23
Cheat Sheet: Simple Authentication in Rails 5 with has_secure_password

Cheat Sheet: Simple Authentication in Rails 6 with has_secure_password

The goal of this cheatsheet is to make it easy to add hand-rolled authentication to any rails app in a series of layers.

First the simplest/core layers, then optional layers depending on which features/functionality you want.

Specs
AUTHOR Ira Herman
LANGUAGE/STACK Ruby on Rails Version 4, 5, or 6
@govindpatel
govindpatel / Elasticsearch install and uninstall.txt
Last active September 9, 2021 04:35 — forked from jkubacki/gist:e2dd904bd648b0bd4554
Mac uninstall elasticsearch / install
#!/usr/bin/env sh
# checks to see if running
launchctl list | grep elasticsearch
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
launchctl remove homebrew.mxcl.elasticsearch
pkill -f elasticsearch
@gtallen1187
gtallen1187 / slope_vs_starting.md
Created November 2, 2015 00:02
A little bit of slope makes up for a lot of y-intercept

"A little bit of slope makes up for a lot of y-intercept"

01/13/2012. From a lecture by Professor John Ousterhout at Stanford, class CS140

Here's today's thought for the weekend. A little bit of slope makes up for a lot of Y-intercept.

[Laughter]

@LeZuse
LeZuse / macos-setup.md
Last active January 15, 2024 14:40
macOS Machine Setup

Mac OS Dev Machine Setup

General

For latest settings refer to this comment

For previous settings check this Gist revisions

Remarks

  • always read and follow Homebrew formulae installation instructions
@quinncomendant
quinncomendant / umbrella
Last active May 13, 2022 06:52
[WARNING: this script no longer works with newer versions of the roaming client software, which now has a *Disable* control in its menu so use that instead.] Cisco Umbrella Roaming Client management script for Mac OS X. This makes it easy to manage the background processes of umbrella to start, stop, restart, sleep and get status.
#!/bin/bash
# Quinn Comendant <quinn@strangecode.com>
# https://gist.github.com/quinncomendant/3be731567e529415d5ee
# Since 25 Jan 2015
# Version 1.2.2
# q 13942 0.0 0.3 4408332 22096 ?? SN 7:32PM 0:00.27 /Applications/OpenDNS Roaming Client/RoamingClientMenubar.app/Contents/MacOS/RoamingClientMenubar
# nobody 13937 0.0 0.1 4296740 5164 ?? Ss 7:31PM 0:00.06 /usr/local/sbin/dnscrypt-proxy --user nobody --local-address=127.0.0.1:53 --plugin=libdcplugin_erc.so -d
# root 13903 0.0 0.2 4366308 13752 ?? SNs 7:31PM 0:00.25 /Library/Application Support/OpenDNS Roaming Client/dns-updater
@qrush
qrush / gist:10401517
Created April 10, 2014 16:51
Replace tabs with 4 spaces, remove leading spaces/tabs for Objective-C .m, .h files
find . -name "*.[mh]" | while read line; do expand -t 4 $line > $line.new; mv $line.new $line; done
find . -name "*.[mh]" | while read line; do git stripspace < $line > $line.new; mv $line.new $line; done
@jvns
jvns / interview-questions.md
Last active April 25, 2024 15:52
A list of questions you could ask while interviewing

A lot of these are outright stolen from Edward O'Campo-Gooding's list of questions. I really like his list.

I'm having some trouble paring this down to a manageable list of questions -- I realistically want to know all of these things before starting to work at a company, but it's a lot to ask all at once. My current game plan is to pick 6 before an interview and ask those.

I'd love comments and suggestions about any of these.

I've found questions like "do you have smart people? Can I learn a lot at your company?" to be basically totally useless -- everybody will say "yeah, definitely!" and it's hard to learn anything from them. So I'm trying to make all of these questions pretty concrete -- if a team doesn't have an issue tracker, they don't have an issue tracker.

I'm also mostly not asking about principles, but the way things are -- not "do you think code review is important?", but "Does all code get reviewed?".