├── .gitignore ├── Gemfile ├── Gemfile.lock ├── LICENSE.txt ├── README.md ├── Rakefile ├── add-collaborators ├── add-to-org.rb ├── common.rb ├── create-assigned-issue ├── generaterandomchanges ├── generaterandomfiles ├── git-graphlive ├── historytailbash ├── historytailzprezto ├── historytailzsh ├── script └── bootstrap ├── transpose ├── transpose-csv.rb ├── treelive ├── vendor └── cache │ ├── addressable-2.8.5.gem │ ├── base64-0.2.0.gem │ ├── faraday-2.7.11.gem │ ├── faraday-net_http-3.0.2.gem │ ├── octokit-4.25.1.gem │ ├── public_suffix-5.0.3.gem │ ├── ruby2_keywords-0.0.5.gem │ └── sawyer-0.9.2.gem ├── welcome └── windows ├── README.md ├── killprogs.bat ├── launch_ff.bat ├── setalias.bat ├── start_training.bat └── unsetalias.bat /.gitignore: -------------------------------------------------------------------------------- 1 | /.bundle/ 2 | /vendor/gems 3 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'octokit', '~> 4.25' 4 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | addressable (2.8.5) 5 | public_suffix (>= 2.0.2, < 6.0) 6 | base64 (0.2.0) 7 | faraday (2.7.11) 8 | base64 9 | faraday-net_http (>= 2.0, < 3.1) 10 | ruby2_keywords (>= 0.0.4) 11 | faraday-net_http (3.0.2) 12 | octokit (4.25.1) 13 | faraday (>= 1, < 3) 14 | sawyer (~> 0.9) 15 | public_suffix (5.0.3) 16 | ruby2_keywords (0.0.5) 17 | sawyer (0.9.2) 18 | addressable (>= 2.3.5) 19 | faraday (>= 0.17.3, < 3) 20 | 21 | PLATFORMS 22 | ruby 23 | 24 | DEPENDENCIES 25 | octokit (~> 4.25) 26 | 27 | BUNDLED WITH 28 | 1.17.2 29 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | # MIT License 2 | 3 | Copyright (c) 2010, Matthew McCullough, Ambient Ideas, LLC 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Training::Utils 2 | 3 | This is a package of git- and github-training scripts into an easily-installed package. This collection of utilities originated [here](https://github.com/matthewmccullough/scripts). 4 | 5 | ## Installation 6 | 7 | If you have Ruby >= 1.9 installed, you can install these scripts into a directory in your `$PATH` by running: 8 | 9 | ``` 10 | $ script/bootstrap 11 | ``` 12 | 13 | ## Usage 14 | 15 | #### `generaterandomchanges ` 16 | 17 | Generates **N** new **commits**, the content of each is a new file named "`.`" with some random text. 18 | 19 | ``` 20 | $ generaterandomchanges 3 file txt 21 | [master f377b54] A random change of 27129 to file1.txt 22 | 2 files changed, 7 insertions(+), 1 deletion(-) 23 | create mode 100644 file1.txt 24 | [master fd0965c] A random change of 15808 to file2.txt 25 | 1 file changed, 1 insertion(+) 26 | create mode 100644 file2.txt 27 | [master a704698] A random change of 26224 to file3.txt 28 | 1 file changed, 1 insertion(+) 29 | create mode 100644 file3.txt 30 | 31 | $ ls 32 | README.md file1.txt file2.txt file3.txt 33 | 34 | $ git log --oneline 35 | a704698 A random change of 26224 to file3.txt 36 | fd0965c A random change of 15808 to file2.txt 37 | f377b54 A random change of 27129 to file1.txt 38 | ec9bce1 Add readme 39 | ``` 40 | 41 | #### `generaterandomfiles ` 42 | 43 | Generates **N** new **files**, each named "`.`" with some random text. 44 | 45 | ``` 46 | $ generaterandomfiles 3 stuff txt 47 | 48 | $ ls 49 | README.md stuff1.txt stuff2.txt stuff3.txt 50 | 51 | $ git log --oneline 52 | ec9bce1 Add readme 53 | 54 | $ cat stuff1.txt 55 | Some random text: 10660 56 | ``` 57 | 58 | #### `git-graphlive ` 59 | 60 | Perpetually loop `git --no-pager log - --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s' --abbrev-commit --date=relative`. It's like "tail -f" for `git log`. It's sometimes useful to have this on a split screen, showing the git one-line, ASCII art git graph. 61 | 62 | ``` 63 | $ git graphlive 5 64 | * 6cad0b4 - (HEAD, master) A random change of 19964 to file30.txt 65 | * c9fd401 - A random change of 16742 to file29.txt 66 | * d5794af - A random change of 22469 to file28.txt 67 | * b2110a3 - A random change of 32088 to file27.txt 68 | * 75d01a9 - A random change of 12572 to file26.txt 69 | ``` 70 | 71 | #### `historytailbash` and `historytailzsh` 72 | 73 | Perpetually loop through `history`. It's like `tail -f` for history. Comes in `bash` and `zsh` flavors. It's sometimes useful to have this on a split screen, showing the recent history of commands. 74 | 75 | #### `transpose .csv` 76 | 77 | Generate a transposed `*.csv` file from an input file. 78 | 79 | #### `treelive ` 80 | 81 | Perpetually loop `tree`, up to `depth` folders deep in the hierarchy. 82 | 83 | #### `welcome ` 84 | 85 | Prints a welcome message: 86 | 87 | ``` 88 | ------------------------------------------------- 89 | Welcome to class on: Wed Jan 14 17:00:35 CST 2015 90 | I'm Instructor Name Here, your instructor 91 | ------------------------------------------------- 92 | ``` 93 | 94 | ## Other Useful Apps 95 | 96 | When training, we use lots of other apps. Here are some of our favorites: 97 | - [Caffeine](https://itunes.apple.com/us/app/caffeine/id411246225) 98 | - [Mouseposé](https://itunes.apple.com/app/mousepose/id405904955?mt=12) 99 | - [ScreenFlow](http://www.telestream.net/screenflow/overview.htm) for recording screen casts 100 | - Skitch classic for Mac OSX (hard DMG to find nowadays) 101 | - [Quickres](http://www.quickresapp.com/) 102 | - [Switch ResX](http://www.madrau.com/) 103 | - [Shush](https://itunes.apple.com/us/app/shush-microphone-manager/id496437906?mt=12) 104 | - [AirSketch](http://www.qrayon.com/home/airsketch/) 105 | - [A Web Whiteboard](https://awwapp.com/) 106 | - [Duet Display](http://www.duetdisplay.com/) 107 | - [Slate](https://github.com/jigish/slate) (looks like it stopped getting commits in 2013, but I still use it 108 | - [Divvy](http://mizage.com/divvy/) 109 | - [Better Snap Tool](https://itunes.apple.com/us/app/bettersnaptool/id417375580?mt=12) 110 | 111 | ## Contributing 112 | 113 | 1. Fork it ( https://github.com/github/training-utils/fork ) 114 | 2. Create your feature branch (`git checkout -b my-new-feature`) 115 | 3. Commit your changes (`git commit -am 'Add some feature'`) 116 | 4. Push to the branch (`git push origin my-new-feature`) 117 | 5. Create a new Pull Request 118 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'fileutils' 2 | 3 | task default: :install 4 | 5 | task :install do 6 | scripts = Dir['*'] - %w{script vendor common.rb Gemfile Gemfile.lock LICENSE.txt Rakefile README.md} 7 | target = ENV["TARGET"] || ask_for_target_dir 8 | File.directory?(File.expand_path(target)) or abort("Install directory isn't a directory") 9 | 10 | scripts.each do |filename| 11 | puts " Linking #{target}/#{filename}" 12 | path_to_target = File.join File.expand_path(target), filename 13 | if File.exist?(path_to_target) && File.symlink?(path_to_target) 14 | FileUtils.rm(path_to_target) 15 | end 16 | FileUtils.symlink File.absolute_path(filename), path_to_target 17 | end 18 | end 19 | 20 | def ask_for_target_dir 21 | puts "Directory to install? (needs to be in your $PATH; /usr/local/bin is the default, hit enter to use that)" 22 | answer = STDIN.gets.chomp 23 | (answer unless answer == "") || "/usr/local/bin" 24 | end 25 | -------------------------------------------------------------------------------- /add-collaborators: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | banner = <<-BANNER 3 | Usage: add-collaborators [ or options] 4 | BANNER 5 | 6 | # add as collaborators anyone who comments on a given issue in a given repo 7 | # assumes you store the appropriate OAuth token as an ENV variable called GITHUBTEACHER_TOKEN 8 | 9 | require 'octokit' 10 | require 'optparse' 11 | require_relative 'common' 12 | 13 | access_token = ENV['GITHUBTEACHER_TOKEN'] or abort("You need a GitHub Teacher access token") 14 | repo_name, issue_num = nil, nil 15 | 16 | # Make sure arguments are specified 17 | ARGV << '-h' if ARGV.empty? 18 | 19 | ARGV.options do |opts| 20 | opts.banner = banner 21 | opts.on("-r", "--repo REPOSITORY", String) { |val| repo_name = val } 22 | opts.on("-i", "--issue ISSUE", Numeric) { |val| issue_num = val } 23 | opts.on_tail("-h", "--help") { abort opts.to_s } 24 | opts.parse! 25 | end 26 | 27 | if ARGV.any? 28 | r, i = parse_issue_url(ARGV.first) 29 | repo_name ||= r 30 | issue_num ||= i 31 | end 32 | 33 | abort ARGV.options.to_s unless [repo_name, issue_num].all? 34 | 35 | puts({repo_name: repo_name, issue_num: issue_num}.inspect) 36 | 37 | # Create a new Octokit Client 38 | Octokit.auto_paginate = true 39 | client = Octokit::Client.new :access_token => access_token 40 | 41 | # Save a little time - build a hash of current collaborators so we can skip them later 42 | current_collaborators = Hash[client.collaborators(repo_name).map { |collaborator| 43 | [collaborator[:login], collaborator[:login]] 44 | }] 45 | 46 | # Get Issue Commenters and Add as Collaborators 47 | successfully_added_users = [] 48 | begin 49 | client.issue_comments(repo_name, issue_num).each do |comment| 50 | username = comment[:user][:login] 51 | next if current_collaborators[username] # skip adding if already a collaborator 52 | if user_added = client.add_collaborator(repo_name, username) 53 | successfully_added_users << username 54 | else 55 | puts "Failed to add #{username} as a collaborator (check: is githubteacher repository owner?)" 56 | end 57 | end 58 | rescue Octokit::NotFound 59 | abort "[404] - Repository not found:\nIf #{repo_name || "nil"} is correct, are you using the right Auth token?" 60 | rescue Octokit::UnprocessableEntity 61 | abort "[422] - Unprocessable Entity:\nAre you trying to add collaborators to an org-level repository?" 62 | end 63 | 64 | if successfully_added_users.any? 65 | begin 66 | names = "@#{successfully_added_users.first}" 67 | verb = "is" 68 | num = "a" 69 | noun = "collaborator" 70 | 71 | if successfully_added_users.size > 1 72 | verb = "are" 73 | num = "" 74 | noun = "collaborators" 75 | 76 | if successfully_added_users.size == 2 77 | names = "@#{successfully_added_users.first} and @#{successfully_added_users.last}" 78 | else 79 | at_mentions = successfully_added_users.map { |name| "@#{name}" } 80 | names = "#{at_mentions[0...-1].join(", ")}, and #{at_mentions[-1]}" 81 | end 82 | end 83 | 84 | message = ":tada: #{names} #{verb} now #{num} repository #{noun}. :balloon:" 85 | client.add_comment repo_name, issue_num, message 86 | rescue => e 87 | abort "ERR posting comment (#{e.inspect})" 88 | end 89 | end -------------------------------------------------------------------------------- /add-to-org.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # add USERNAME as member to ORGANIZATION and optionally to TEAM 3 | # assumes you created and stored the appropriate OAuth token as an ENV variable called GITHUBTEACHER_TOKEN 4 | 5 | require 'octokit' 6 | require 'optparse' 7 | 8 | # Make sure arguments are specified 9 | ARGV << '-h' if ARGV.empty? 10 | 11 | # Create options hash 12 | options = {} 13 | 14 | # Parse options 15 | OptionParser.new do |opts| 16 | opts.banner = "Usage: add-to-org.rb [options] 17 | NOTICE: This also assumes you have set up the variable GITHUBTEACHER_TOKEN with administrative privilages.\n\n" 18 | 19 | opts.on("-u", "--username USERNAME", "Username for membership -- ex: githubstudent") do |u| 20 | options[:username] = u 21 | end 22 | 23 | opts.on("-o", "--org ORGANIZATION", "Organization name -- ex: githubschool") do |o| 24 | options[:org] = o 25 | end 26 | 27 | opts.on("-t", "--team TEAM_NAME", "[Optional] Team to add member to -- ex: developers") do |t| 28 | options[:team] = t 29 | end 30 | 31 | opts.on_tail("-h", "--help", "Prints this help message") do |h| 32 | puts opts 33 | exit 34 | end 35 | 36 | end.parse! 37 | 38 | 39 | TOKEN = ENV['GITHUBTEACHER_TOKEN'] 40 | abort("Missing GITHUBTEACHER_TOKEN. Please set up an OAUTH token and set it in the environment by typing\n 41 | export GITHUBTEACHER_TOKEN=XXXXXXXXXXXXXXXXXXXXXXX\n 42 | and replace the Xs with your actual token. Reminder: This token needs admin privilages onto your organization in order to be inviting people.") unless TOKEN 43 | 44 | # Assign variables 45 | # Team is optional, so you don't need to assign it if it's nil. 46 | username = options[:username] 47 | org = options[:org] 48 | team_name = options[:team] if !options[:team].nil? 49 | 50 | 51 | # Create a new Octokit Client 52 | Octokit.auto_paginate = true 53 | @client = Octokit::Client.new :access_token => TOKEN 54 | 55 | # If the team doesn't exist yet, create it 56 | # otherwise, get the team_id from the list 57 | # Once we have the team_id we can add people to it 58 | # regardless of them being a member of the organization yet 59 | def add_to_team_and_org(team_name, username, org) 60 | 61 | team_id = if team_id.nil? 62 | create_team(org, team_name, org) 63 | else 64 | get_team_id(team_name, org) 65 | end 66 | 67 | # Add username to team_id 68 | # Slightly different than adding them as a member. 69 | # If the username includes ","s, split it because it's a full list! 70 | username.split(",").each do |name| 71 | @client.add_team_membership(team_id, name) 72 | puts "#{name} added to #{team_name}." 73 | end 74 | 75 | end 76 | 77 | # Returns team_id 78 | def create_team(team_id, team_name, org) 79 | response = @client.create_team(org, {:name => team_name}) 80 | team_id = response.id 81 | puts "Team '#{team_name}' created at https://github.com/orgs/#{org}/teams" unless team_id.nil? 82 | 83 | team_id 84 | end 85 | 86 | def get_team_id(team_name, org) 87 | team_id = nil 88 | team_list = @client.org_teams(org) 89 | 90 | team_list.each do |team| 91 | if team.name == team_name 92 | team_id = team.id 93 | end 94 | end 95 | team_id 96 | 97 | end 98 | 99 | # If they just want to add users as members, skip the team 100 | def add_to_org(org, username) 101 | username.split(",").each do |name| 102 | @client.update_organization_membership(org, {:user => name}) 103 | puts "#{name} added to #{org}." 104 | end 105 | end 106 | 107 | begin 108 | if !team_name.nil? 109 | add_to_team_and_org(team_name, username, org) 110 | else 111 | add_to_org(org, username) 112 | end 113 | rescue Octokit::Forbidden 114 | abort "[403] - Unable to add member to organization. Check that the GITHUBTEACHER_TOKEN was created with administrative privilages so that you can add members to the organization" 115 | rescue Octokit::Unauthorized 116 | abort "[401] - The credentials you've supplied are no longer valid. Please generate a new token." 117 | end 118 | -------------------------------------------------------------------------------- /common.rb: -------------------------------------------------------------------------------- 1 | REGEX = %r{github\.com/([^/]+/[^/]+)/issues/(\d+)} 2 | # https://github.com/username/reponame/issues/2 3 | # -> username/reponame, 2 4 | def parse_issue_url(url) 5 | if md = REGEX.match(url) 6 | [md[1], md[2]] 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /create-assigned-issue: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | banner = <<-BANNER 3 | Usage: create-assigned-issue 4 | * Copies issue as template 5 | * Replaces any references to the assigned user (eg, at-mentions, etc.) 6 | * Also "undoes" any checkboxes in issue template (eg, [x] -> [ ]) 7 | * For each collaborator of repo, creates a new issue, assigned to collaborator 8 | BANNER 9 | 10 | $stderr.sync = true 11 | require 'octokit' 12 | require 'optparse' 13 | require_relative 'common' 14 | 15 | file = __FILE__ 16 | issue_url = ARGV.first 17 | 18 | abort banner if !issue_url || issue_url == '-h' 19 | 20 | Octokit.auto_paginate = true 21 | 22 | client = Octokit::Client.new :access_token => ENV['GITHUBTEACHER_TOKEN'] 23 | repo, number = parse_issue_url(issue_url) 24 | issue = client.issue(repo, number) 25 | assigned = issue.assignee.login 26 | template = issue.body.gsub("[x] ", "[ ] ") 27 | template = template.gsub("#{assigned}", "%{assignee}") 28 | title = issue.title 29 | title = title.gsub("#{assigned}", "%{assignee}") 30 | 31 | client.collaborators(repo).each do |collaborator| 32 | next if assigned == collaborator[:login] 33 | title = title % { assignee: collaborator[:login] } 34 | body = template % { assignee: collaborator[:login] } 35 | assignee = collaborator[:login] 36 | 37 | puts "Creating assigned issue for @#{collaborator[:login]}" 38 | client.create_issue repo, title, body, assignee: assignee 39 | end 40 | -------------------------------------------------------------------------------- /generaterandomchanges: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Ensure we have the quantity specified on the CLI 4 | if [ -z "$3" ]; then ARG_ERR=ERR; fi 5 | if [ -z "$2" ]; then ARG_ERR=ERR; fi 6 | if [ -z "$1" ]; then ARG_ERR=ERR; fi 7 | if [ -n "$ARG_ERR" ]; 8 | then 9 | echo "Usage: " 10 | exit 11 | fi 12 | 13 | count=$1 14 | filenamebase=$2 15 | filenameextension=$3 16 | for (( filenumber = 1; filenumber <= $count ; filenumber++ )); do 17 | echo "Some new random text: $RANDOM" >> $filenamebase$filenumber.$filenameextension 18 | git add $filenamebase$filenumber.$filenameextension 19 | git commit -m"A random change of $RANDOM to $filenamebase$filenumber.$filenameextension" 20 | done 21 | -------------------------------------------------------------------------------- /generaterandomfiles: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Ensure we have the quantity specified on the CLI 4 | if [ -z "$3" ]; then ARG_ERR=ERR; fi 5 | if [ -z "$2" ]; then ARG_ERR=ERR; fi 6 | if [ -z "$1" ]; then ARG_ERR=ERR; fi 7 | if [ -n "$ARG_ERR" ]; 8 | then 9 | echo "Usage: " 10 | exit 11 | fi 12 | 13 | count=$1 14 | filenamebase=$2 15 | filenameextension=$3 16 | for (( filenumber = 1; filenumber <= $count ; filenumber++ )); do echo "Some random text: $RANDOM" > $filenamebase$filenumber.$filenameextension; done -------------------------------------------------------------------------------- /git-graphlive: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | commits=$1 4 | #Defaults commits to 10 5 | if [ -z "$1" ]; 6 | then 7 | commits=10 8 | fi 9 | 10 | 11 | while : 12 | do 13 | clear 14 | git --no-pager log -$commits --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s' --abbrev-commit --date=relative 15 | sleep 2 16 | done 17 | -------------------------------------------------------------------------------- /historytailbash: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Add the following 2 lines to your ~/.bashrc file to tell bash to save your history 4 | # to the history file after each command rather than after shell exit 5 | # 6 | # shopt -s histappend 7 | # PROMPT_COMMAND="history -a;$PROMPT_COMMAND" 8 | # 9 | 10 | #Ensure we have the quantity specified on the CLI 11 | if [ -z "$2" ]; then ARG_ERR=ERR; fi 12 | if [ -z "$1" ]; then ARG_ERR=ERR; fi 13 | if [ -n "$ARG_ERR" ]; 14 | then 15 | echo "Usage: " 16 | exit 17 | fi 18 | 19 | sleeptimesecs=$1 20 | numberoflines=$2 21 | 22 | # Tail history 23 | while [ 1 ]; do 24 | clear 25 | tail -$numberoflines ~/.bash_history 26 | sleep $sleeptimesecs 27 | done 28 | -------------------------------------------------------------------------------- /historytailzprezto: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #Ensure we have the quantity specified on the CLI 4 | if [ -z "$2" ]; then ARG_ERR=ERR; fi 5 | if [ -z "$1" ]; then ARG_ERR=ERR; fi 6 | if [ -n "$ARG_ERR" ]; 7 | then 8 | echo "Usage: " 9 | exit 10 | fi 11 | 12 | sleeptimesecs=$1 13 | numberoflines=$2 14 | 15 | # Tail history 16 | while [ 1 ]; do 17 | clear 18 | tail -$numberoflines ~/.zhistory | sed s/^.*\;// 19 | sleep $sleeptimesecs 20 | done 21 | -------------------------------------------------------------------------------- /historytailzsh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #Ensure we have the quantity specified on the CLI 4 | if [ -z "$2" ]; then ARG_ERR=ERR; fi 5 | if [ -z "$1" ]; then ARG_ERR=ERR; fi 6 | if [ -n "$ARG_ERR" ]; 7 | then 8 | echo "Usage: " 9 | exit 10 | fi 11 | 12 | sleeptimesecs=$1 13 | numberoflines=$2 14 | 15 | # Tail history 16 | while [ 1 ]; do 17 | clear 18 | tail -$numberoflines ~/.zsh_history | sed s/^.*\;// 19 | sleep $sleeptimesecs 20 | done 21 | -------------------------------------------------------------------------------- /script/bootstrap: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # resolves all dependencies that the application requires to run 4 | 5 | set -e 6 | 7 | cd "$(dirname "$0")/.." 8 | 9 | # make sure bundler installed 10 | which bundler 2>&1 >/dev/null || gem install bundler 11 | 12 | # make sure needed gems installed 13 | bundle check --path vendor/gems 2>&1 >/dev/null || bundle install --path vendor/gems --quiet 14 | 15 | # install scripts 16 | rake 17 | -------------------------------------------------------------------------------- /transpose: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Usage: 4 | # transpose .csv 5 | 6 | # use the right `transpose-csv.rb` 7 | if test ! $(which transpose); then 8 | # local 9 | _transpose="./transpose-csv.rb" 10 | else 11 | # symlink, after running `script/bootstrap` 12 | _transpose="$(which transpose)-csv.rb" 13 | fi 14 | 15 | _inputfile=${1} 16 | _extension="${_inputfile##*.}" 17 | 18 | if [ "${_extension}" != "csv" ]; then 19 | echo "ERROR: '${_inputfile}' it not a '*.csv' file" 20 | exit 1 21 | fi 22 | 23 | if [ ! -f "${_inputfile}" ]; then 24 | echo "ERROR: '${_inputfile}' not found" 25 | exit 1 26 | fi 27 | 28 | _outputfile="${_inputfile%%.*}-transposed.csv" 29 | # _outputfile="${_inputfile%%.*}-`date +%Y-%m-%d`.csv" 30 | 31 | "${_transpose}" "${_inputfile}" 32 | 33 | echo "SUCCESS: '${_outputfile}' created" 34 | exit 0 35 | -------------------------------------------------------------------------------- /transpose-csv.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'CSV' 3 | 4 | def get_dest(src) 5 | dest = src.split('.') 6 | dest[0] += '-transposed' 7 | dest.join('.') 8 | end 9 | 10 | src = ARGV[0] 11 | file = File.open(src, "r:ISO-8859-1") 12 | rows = CSV.parse(file) 13 | 14 | CSV.open(get_dest(src), "wb") do |csv| 15 | rows.transpose.each do |row| 16 | csv << row 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /treelive: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Ensure we have the quantity specified on the CLI 4 | if [ -z "$1" ]; then ARG_ERR=ERR; fi 5 | if [ -n "$ARG_ERR" ]; 6 | then 7 | echo "Usage: treelive " 8 | echo "Usage: treelive " 9 | exit 10 | fi 11 | 12 | DEPTH=$1 13 | 14 | while : 15 | do 16 | clear 17 | tree -L $* 18 | sleep 2 19 | done 20 | -------------------------------------------------------------------------------- /vendor/cache/addressable-2.8.5.gem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/github/training-utils/ec611e36634339763fb34160205110f1722810cb/vendor/cache/addressable-2.8.5.gem -------------------------------------------------------------------------------- /vendor/cache/base64-0.2.0.gem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/github/training-utils/ec611e36634339763fb34160205110f1722810cb/vendor/cache/base64-0.2.0.gem -------------------------------------------------------------------------------- /vendor/cache/faraday-2.7.11.gem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/github/training-utils/ec611e36634339763fb34160205110f1722810cb/vendor/cache/faraday-2.7.11.gem -------------------------------------------------------------------------------- /vendor/cache/faraday-net_http-3.0.2.gem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/github/training-utils/ec611e36634339763fb34160205110f1722810cb/vendor/cache/faraday-net_http-3.0.2.gem -------------------------------------------------------------------------------- /vendor/cache/octokit-4.25.1.gem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/github/training-utils/ec611e36634339763fb34160205110f1722810cb/vendor/cache/octokit-4.25.1.gem -------------------------------------------------------------------------------- /vendor/cache/public_suffix-5.0.3.gem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/github/training-utils/ec611e36634339763fb34160205110f1722810cb/vendor/cache/public_suffix-5.0.3.gem -------------------------------------------------------------------------------- /vendor/cache/ruby2_keywords-0.0.5.gem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/github/training-utils/ec611e36634339763fb34160205110f1722810cb/vendor/cache/ruby2_keywords-0.0.5.gem -------------------------------------------------------------------------------- /vendor/cache/sawyer-0.9.2.gem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/github/training-utils/ec611e36634339763fb34160205110f1722810cb/vendor/cache/sawyer-0.9.2.gem -------------------------------------------------------------------------------- /welcome: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | answer=$@ 4 | #Ask for instructor unless specified 5 | if [ -z "$1" ]; 6 | then 7 | printf "Instructor name? " 8 | read answer 9 | fi 10 | 11 | clear 12 | 13 | echo '-------------------------------------------------' 14 | echo 'Welcome to class on:' `date` 15 | echo "I'm ${answer}, your instructor " 16 | echo '-------------------------------------------------' 17 | echo 18 | -------------------------------------------------------------------------------- /windows/README.md: -------------------------------------------------------------------------------- 1 | # GitHub Training Setup Scripts 2 | When doing training one of the distracting things that can happen is that you will receive a **popup** message from your email client, Slack Notification, or other program running in the background. This script is intended to help shutdown those programs that might interrupt your training session. 3 | 4 | The possible disctration is that your **Daily Browser** may have a lot of tool bar entries that may disctrct the audience. In my environment I use Chrome as my primary browswer, so I have chosen to launch a **Clean FireFox** browser instead for training. 5 | 6 | 7 | *This initial version works for Windows 7, but the concept should be easy to port to MAC or Linux* 8 | 9 | | Script FIle | Description | 10 | |-------------|-------------| 11 | | killprogs.bat | Simple script that runs through a list of programs to terminate. The `/f` switch forces the program to terminate | 12 | | launch_ff.bat | Launches the **FireFox** browswer from the standard installation location with a few **starting** webpages for training | 13 | | setalias.bat | A quick way to setup my normal development git alias'. It is a bit annoying when you keep using your alias' and the people your training don't have them setup as well. | 14 | | start_training.bat | Launch the killprogs.bat, unsetalias.bat, and launch_ff.bat scripts | 15 | | unsetalias.bat | Quickly unset some of my common git alias' so I am forced to use the long hand command for training.| 16 | 17 | ## Customization 18 | If you need to add more programs to the `killprogs.bat` file you can simply run `tasklist` from a Windows command line to see the full name of the program to kill. 19 | 20 | If you have any suggestions/comments please feel free to leave issues on this repository, if you would like to help with other platforms I look forward to working with you. 21 | -------------------------------------------------------------------------------- /windows/killprogs.bat: -------------------------------------------------------------------------------- 1 | taskkill /f /IM slack.exe 2 | taskkill /f /IM outlook.exe 3 | taskkill /f /IM Lync.exe 4 | taskkill /f /IM Evernote.exe 5 | taskkill /f /IM Chrome.exe 6 | taskkill /f /IM iTunesHelper.exe 7 | taskkill /f /IM iTunes.exe 8 | taskkill /f /IM BtITunesPlugIn.exe 9 | -------------------------------------------------------------------------------- /windows/launch_ff.bat: -------------------------------------------------------------------------------- 1 | "c:\Program Files (x86)\Mozilla Firefox\firefox.exe" https://guides.github.com/introduction/flow/ http://git-school.github.io/visualizing-git/ http://learngitbranching.js.org/?NODEMO https://services.github.com/on-demand/images/config-levels.jpg https://services.github.com/on-demand/images/two-stage-commit-a.jpg https://services.github.com/on-demand/images/reset-modes.jpg 2 | -------------------------------------------------------------------------------- /windows/setalias.bat: -------------------------------------------------------------------------------- 1 | git config --global alias.s "status" 2 | git config --global alias.lg "log --graph --format=short --decorate=short --all" 3 | -------------------------------------------------------------------------------- /windows/start_training.bat: -------------------------------------------------------------------------------- 1 | call killprogs.bat 2 | call unsetalias.bat 3 | call launch_ff.bat 4 | -------------------------------------------------------------------------------- /windows/unsetalias.bat: -------------------------------------------------------------------------------- 1 | git config --global --unset alias.s 2 | git config --global --unset alias.lg 3 | --------------------------------------------------------------------------------