Skip to content

Instantly share code, notes, and snippets.

Michael Taylor Scheer ScheerMT

Block or report user

Report or block ScheerMT

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
epeli /
Last active Jun 14, 2019
Install Systemd units using Ansible
Install Systemd units using Ansible
Handles unit restarting and systemd daemon reloading when the unit changes.
Also stops the unit correctly when uninstalled
In your playbook put this file to library/ and make sure the
server has python-sh package installed

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.

amitmerchant1990 / stylish.css
Last active Dec 28, 2018
GitHub Fixed Header for better accessibility.
View stylish.css
1. Install the Stylish( extension for Chrome.
2. Open up extension options and paste the whole CSS mentioned below.
3. Specify the domain name to be ``.
4. Add a title and save.
.header {
padding-top: 10px;
padding-bottom: 10px;
anonymous / GAME_MASTER_v0_1.protobuf
Created Jul 16, 2016
Pokemon Go decoded GAME_MASTER protobuf file v0.1
View GAME_MASTER_v0_1.protobuf
Result: 1
Items {
Badge {
BadgeRanks: 4
Targets: "\nd\350\007"
Items {
View gist:a92501d1e0adf13cadf66163d0bf05e7
The description of the method
- parameter parameterName1: description of param
- parameter parameterName2: description of param
- returns: description of return value
(undefined but common things)
- complexity: O(1).
- note: a note
- requires: The next value is representable.
acrookston /
Last active Oct 18, 2019
Xcode pre-action to build custom Info.plist

Automatic build versions from git in Xcode (and other goodies)

Installation procedure for pre-build actions to automatically populate Xcode Info.plist with dynamic data.

1. Xcode Scheme pre-action

Edit Xcode Scheme and add a pre-action script. Copy the contents of into the pre-action script box.

tapi / UICollectionView+Registration.swift
Created Apr 4, 2016
Typed UITableView & UICollectionView Dequeuing in Swift
View UICollectionView+Registration.swift
import UIKit
extension UICollectionReusableView {
/// The default implementation of `defaultIdentifier()` uses `NSStringFromClass(class)` rather than `String(class)` so that the module name is includded.
/// The hope being that this makes collisions unlikely making it unnnecessary to provide your own implementations.
public class func defaultIdentifier() -> String {
return NSStringFromClass(self)
dannguyen /
Last active Sep 26, 2019
Using Python 3.x and Google Cloud Vision API to OCR scanned documents to extract structured data

Using Python 3 + Google Cloud Vision API's OCR to extract text from photos and scanned documents

Just a quickie test in Python 3 (using Requests) to see if Google Cloud Vision can be used to effectively OCR a scanned data table and preserve its structure, in the way that products such as ABBYY FineReader can OCR an image and provide Excel-ready output.

The short answer: No. While Cloud Vision provides bounding polygon coordinates in its output, it doesn't provide it at the word or region level, which would be needed to then calculate the data delimiters.

On the other hand, the OCR quality is pretty good, if you just need to identify text anywhere in an image, without regards to its physical coordinates. I've included two examples:

####### 1. A low-resolution photo of road signs

vasanthk / System
Last active Oct 18, 2019
System Design Cheatsheet
View System

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
gonzalezreal /
Last active Oct 17, 2019
iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

A common task when developing iOS apps is to register custom cell subclasses for both UITableView and UICollectionView. Well, that is if you don’t use Storyboards, of course.

Both UITableView and UICollectionView offer a similar API to register custom cell classes:

public func registerClass(cellClass: AnyClass?, forCellWithReuseIdentifier identifier: String)
public func registerNib(nib: UINib?, forCellWithReuseIdentifier identifier: String)
You can’t perform that action at this time.