This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A memory efficient deduplication class used in cases where a | |
# duplicate object can only occur within n objects of each other. | |
class MemoryDedup | |
# Returns a new deduper. | |
# | |
# == Options | |
# * <tt>:size</tt> - the number of objects to store in the cache | |
def initialize(options = {}) | |
@size = options{:size} || 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First create a column on the parent object to keep track of the next scoped_id: | |
class CreateProjects < ActiveRecord::Migration | |
def change | |
create_table :projects do |t| | |
... | |
t.integer :bugs_sequence | |
... | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
IFS=$'\n' | |
names=`git log --no-merges --all --since="3 months ago" --format='%aN' | sort -u` | |
printf "%-20s %10s %10s %10s\n" "Name" "Chng Files" "Lns Insert" "Lns Delete" | |
printf "%-20s %10s %10s %10s\n" "--------------------" "----------" "----------" "----------" | |
for n in ${names}; do | |
gitstat=`git log --no-merges --all --shortstat --since="3 months ago" --author="${n}" | grep -E "fil(e|es) changed" | awk '{files+=$1; inserted+=$4; deleted+=$6} END {printf "%10s %10s %10s", files, inserted, deleted }'` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generate_round_robin_balanced_schedule(teams: 8, rounds: 1) | |
matches = [] | |
(1..rounds).each do |round| | |
team_sequence = [0] # the first team is fixed | |
offset = round % (teams - 1) | |
(1..(teams - 1)).each do | |
offset = 1 if offset >= teams | |
offset = (teams - 1) if offset == 0 | |
team_sequence << offset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generate_berger_schedule(teams: 8, rounds: 1) | |
matches = [] | |
team_sequence = (1..(teams - 1)).to_a | |
(1..rounds).each do |round| | |
team_sequence_for_round = [] | |
games = [] | |
if round.even? | |
team_sequence_for_round = Array.new(team_sequence) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cat <<EOF | kubectl create -f - | |
apiVersion: rbac.authorization.k8s.io/v1beta1 | |
kind: ClusterRoleBinding | |
metadata: | |
name: kubernetes-dashboard | |
labels: | |
k8s-app: kubernetes-dashboard | |
roleRef: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env osascript | |
tell application "Chrome" | |
set bounds of front window to {100, 100, 1700, 1180} | |
end tell |