Skip to content

Instantly share code, notes, and snippets.

View clathrop's full-sized avatar

Carter Lathrop clathrop

View GitHub Profile
@clathrop
clathrop / ratelimit.utils.ts
Created June 30, 2022 20:09
Javascript API rate-limit utility using lru-cache
import LRU from "lru-cache"
type RateLimitOptions = {
uniqueTokenPerInterval: number
interval: number
}
// This rateLimit utility utilizes an lru cache to keep track of
// request limits for the API.
//
parse_git_branch() {
git branch 2>/dev/null | grep \* | sed -ne 's#\* ##p' | awk -F / '{print " [GIT:"$0 "]"}'
}
export PS1='\[\033[00;32m\]\w\[\033[00m\]$(parse_git_branch)\$ '
########### ALIASES ##############
#commands to change window size, big and small
alias smw="printf '\033[8;25;100t'"
alias lgw="printf '\033[8;50;150t'"
#quick edit bash profile
@clathrop
clathrop / iterm2-profile-configuration.json
Created February 8, 2018 19:48
iTerm 2 Profile Configuration
{
"Ansi 6 Color" : {
"Green Component" : 0.80000000000000004,
"Red Component" : 0.40000000000000002,
"Blue Component" : 0.80000000000000004
},
"Tags" : [
"osx",
"tomorrow",
"night",
@clathrop
clathrop / gist:900ebba28b3e6962b82cc574c0fca002
Created July 14, 2017 01:09
How to Install & Use Sound Cloud Downloader (scdl)
https://github.com/flyingrub/scdl
Installation (assumes you're on mac osx)
1. Open up Terminal
2. Follow the directions on this (http://python-guide-pt-br.readthedocs.io/en/latest/starting/install3/osx/) page to install homebrew (think of this like a quick package/application manager for OSX) and python3.
It's important that you have python3 (and not python 2.x)
3. With step 2 you have homebrew, python3 and pip3 installed
@clathrop
clathrop / 0_reuse_code.js
Last active September 8, 2015 20:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@clathrop
clathrop / postgres_remote_queries.sh
Last active August 29, 2015 14:26
A script to connect to a remote (or local) postgres server to execute queries and handle the results in csv form.
#!/bin/bash
#Script to run automated sql queries
db_host='localhost'
db_port=5432
db_user='postgres'
db_pw=''
db_name='newsroom'
sql_file='loadItems.sql'
@clathrop
clathrop / bd
Created July 31, 2015 20:41
Build-deploy script which looks at the java version defined in a projects pom.xml and sets the environment java version accordingly then runs a maven build and deploy. Supports java 1.7 & 1.8 but can easily be extended to support previous and future java releases.
#!/bin/bash
# Build-deploy script which looks at the java version defined in a projects pom.xml
# and sets the environment java version accordingly then runs a maven build and deploy.
# Supports java 1.7 & 1.8 but can easily be extended to support previous and future java
# releases.
grep "<source>" pom.xml | grep "1.7" >/dev/null
if [ $(echo $?) -eq "0" ]
then
@clathrop
clathrop / .bash_profile
Last active September 30, 2015 01:05
My local .bash_profile
parse_git_branch() {
git branch 2>/dev/null | grep \* | sed -ne 's#\* ##p' | awk -F / '{print " [GIT:"$0 "]"}'
}
export PS1='\[\033[00;32m\]\w\[\033[00m\]$(parse_git_branch)\$ '
########### ALIASES ##############
#commands to change window size, big and small
alias smw="printf '\033[8;25;100t'"
alias lgw="printf '\033[8;50;150t'"
#quick edit bash profile
@clathrop
clathrop / .exrc
Created July 1, 2015 17:09
The .exrc file gives options for the vi editor, here are the ones I use
set ts=4
set autoindent
set number
set showmode
@clathrop
clathrop / remote_env_profile
Created June 26, 2015 21:06
my default remote bash_profile script
#################################################################################
# Add personal setup here.
# give a nickname to this machine for reference purposes on cli
export HOSTNICK="rd35"
parse_git_branch() {
git branch 2>/dev/null | grep \* | sed -ne 's#\* ##p' | awk -F / '{print " [GIT:"$0 "]"}'
}