Skip to content

Instantly share code, notes, and snippets.

View nelsonjchen's full-sized avatar

Nelson Chen nelsonjchen

View GitHub Profile
@nelsonjchen
nelsonjchen / pizza.rb
Created October 18, 2012 05:12 — forked from jroesch/pizza.hs
ACM Micro-Challenge 1
require "test/unit"
# Write a function called numPizzas, that takes the number of people present,
# the number of slices in a pizza, and the time of day, and returns the
# number of pizzas to buy (as a whole integer).
#
# Spec:
# Signature: int numPizzas(int numPeople, int slicesPerPizza, int time)
# Time is an int on 24-hour clock (0-23), e.g. 8 = 8am, 14 = 2pm
# 11 = 11am 11pm = 23
#
# Place this code to your .profile, .bashrc, .bash_profile or whatever
#
program_exists () {
type "$1" &> /dev/null ;
}
if program_exists go; then
@nelsonjchen
nelsonjchen / clone_all_repos.sh
Last active April 6, 2021 20:04 — forked from clrung/clone_all_repos.sh
Clones all repos in a GitHub organization (for input into GNU parallel)
#!/bin/bash
# Usage: clone_all_repos.sh [organization] <output directory>
ORG=$1
PER_PAGE=100
GIT_OUTPUT_DIRECTORY=${2:-"/tmp/${ORG}_repos"}
if [ -z "$GITHUB_TOKEN" ]; then
# https://github.com/settings/tokens
echo -e "Variable GITHUB_TOKEN isn't set! Please specify your GitHub token.\n\nMore info: https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/"