Skip to content

Instantly share code, notes, and snippets.

@TylerBrock
TylerBrock / mta-turnstile.js
Last active March 29, 2020 04:21
Get the turnstile data from NYC MTA website
const fs = require('fs');
const axios = require('axios');
const cheerio = require('cheerio');
const downloadDir = './downloads';
const siteUrl = 'http://web.mta.info/developers/turnstile.html';
async function fetchData() {
const result = await axios.get(siteUrl);
return cheerio.load(result.data);
@TylerBrock
TylerBrock / lru.js
Created February 21, 2020 20:53
Skeleton for LRU cache
/**
Design and implement a Least Recently Used (LRU) cache. It should support the following operations: get and put.
 - get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1.
 - put(key, value) - Set or insert the value if the key is not already present. When the cache reaches its capacity, it should invalidate the least recently used item before inserting a new item.
The cache is always initialized with a positive capacity.
@TylerBrock
TylerBrock / build_and_push.sh
Last active September 15, 2022 07:36
Amazon ECS Deploy Script -- for public use
#!/usr/bin/env bash
set -e
status() {
echo -e "[DEPLOY]: ${1}"
}
# Set the version to the branch name by default
ver_tag=${CIRCLE_BRANCH}
@TylerBrock
TylerBrock / GitHub-Forking.md
Created October 12, 2016 16:52 — forked from Chaser324/GitHub-Forking.md
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, when I started going through the process of forking and issuing pull requests, I had some trouble figuring out the proper method for doing so and made quite a few mistakes along the way. I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your

@TylerBrock
TylerBrock / munge.sh
Created December 3, 2015 18:54
Script to strip enclosing results from Parse data
for file in *.json; do
jq '.results' < "$file" > "$file.scrubbed"
mv "$file" "`basename $file .scrubbed`"
done
@TylerBrock
TylerBrock / settings
Created October 2, 2015 03:11
settings
s
@TylerBrock
TylerBrock / words.go
Last active August 29, 2015 14:27
Go program to find the shortest path from one word to another
package main
import "log"
import "bytes"
import "bufio"
import "os"
import "sync"
import "runtime"
import "io/ioutil"
@TylerBrock
TylerBrock / notes.md
Last active August 29, 2015 14:11
Effective Modern C++ Items 10 + 11

Item 10: Prefer scoped enums to unscoped enums

  • Scoped
    • Generally declaring a name inside of curly braces limits scope to inside the braces.

    • Not so for C++98 style enums.

    • Names belong to scope containing the enum

    • Nothing else in that scope can have the same name

      enum Color { black, white, red }; // black, etc in the same scope as color

@TylerBrock
TylerBrock / crowd.rb
Created November 6, 2014 16:05
Simple Crowd Integration in Ruby
require 'httparty'
require 'logger'
require 'json'
BASE_PATH = '/crowd/rest/usermanagement/'
API_VERSION = 1
AUTH_PATH = '/authentication'
SESSION_PATH = '/session'
USER_PATH = '/user'
### Keybase proof
I hereby claim:
* I am TylerBrock on github.
* I am tyler (https://keybase.io/tyler) on keybase.
* I have a public key whose fingerprint is D683 1F3B 3C62 7B38 E5FD 62D2 F10D 2721 439F 26D5
To claim this, I am signing this object: