Skip to content

Instantly share code, notes, and snippets.

Avatar
🏝️
It's nice in Los Angeles

Nelson Chen nelsonjchen

🏝️
It's nice in Los Angeles
View GitHub Profile
@nelsonjchen
nelsonjchen / clone_all_repos.sh
Last active Apr 6, 2021 — forked from clrung/clone_all_repos.sh
Clones all repos in a GitHub organization (for input into GNU parallel)
View clone_all_repos.sh
#!/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/"
View setupGOROOT.sh
#
# Place this code to your .profile, .bashrc, .bash_profile or whatever
#
program_exists () {
type "$1" &> /dev/null ;
}
if program_exists go; then
@nelsonjchen
nelsonjchen / pizza.rb
Created Oct 18, 2012 — forked from jroesch/pizza.hs
ACM Micro-Challenge 1
View pizza.rb
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