Skip to content

Instantly share code, notes, and snippets.

View cmatheson's full-sized avatar

Cameron Matheson cmatheson

  • WorkOS
  • South Jordan, UT
View GitHub Profile
#!/usr/bin/env ruby
fishes = 9.times.map { 0 }
gets.split(",").map(&:to_i).each { |x| fishes[x] += 1 }
256.times do
new_fishes = fishes.shift
fishes << new_fishes
fishes[6] += new_fishes

Keybase proof

I hereby claim:

  • I am cmatheson on github.
  • I am cmatheson (https://keybase.io/cmatheson) on keybase.
  • I have a public key ASBV3Q1m_5tSIopAyJ5QNGqGvc2_rnELE8it6Hx0Yx0DLgo

To claim this, I am signing this object:

#!/bin/sh
set -e
trap "rm -f tags.$$" EXIT
ctags --tag-relative -Rftags.$$ \
--exclude=.git \
--exclude=public/javascripts/vendor \
--exclude=public/flash \
--exclude=node_modules \
--exclude=public/javascripts/compiled \
--exclude=public/javascripts/bower \
Course.transaction do
c = Course.create! name: "Big Course"
c.offer
s1 = c.course_sections.create! name: "Section 1"
s2 = c.course_sections.create! name: "Section 2"
500.times { |i|
puts "creating user #{i+1}"
u = User.create! name: ("Student %03d" % (i+1))
(Thu May 8 13:58:44 2014) [[sssd[krb5_child[7187]]]] [main] (0x0400): krb5_child started.
(Thu May 8 13:58:44 2014) [[sssd[krb5_child[7187]]]] [unpack_buffer] (0x1000): total buffer size: [140]
(Thu May 8 13:58:44 2014) [[sssd[krb5_child[7187]]]] [unpack_buffer] (0x0100): cmd [241] uid [1628202302] gid [1628200513] validate [true] enterprise principal [true] offline [false] UPN [me@CORP.EXAMPLE.COM]
(Thu May 8 13:58:44 2014) [[sssd[krb5_child[7187]]]] [unpack_buffer] (0x0100): ccname: [FILE:/tmp/krb5cc_1628202302_XXXXXX] keytab: [/etc/krb5.keytab]
(Thu May 8 13:58:44 2014) [[sssd[krb5_child[7187]]]] [set_lifetime_options] (0x0100): Cannot read [SSSD_KRB5_RENEWABLE_LIFETIME] from environment.
(Thu May 8 13:58:44 2014) [[sssd[krb5_child[7187]]]] [set_lifetime_options] (0x0100): Cannot read [SSSD_KRB5_LIFETIME] from environment.
(Thu May 8 13:58:44 2014) [[sssd[krb5_child[7187]]]] [set_canonicalize_option] (0x0100): SSSD_KRB5_CANONICALIZE is set to [true]
(Thu May 8 13:58:44 2014) [[sssd[krb5_child[7187]
@cmatheson
cmatheson / indexer.rb
Created February 2, 2014 05:42
stripectf3 level 3 solution
#!/usr/bin/env ruby
exit if ARGV.shift != "--master"
ARGV.shift until ARGV.empty?
require 'sinatra'
require 'json'
require 'thread'
require 'set'
@cmatheson
cmatheson / present.rb
Created January 30, 2014 19:33
command-line slide viewer
#!/usr/bin/env ruby
require 'io/console'
msg = ARGV.shift or fail "no message text given"
rows, cols = IO.console.winsize
msg_lines = msg.lines.count
N_ASSIGNMENTS=100
N_USERS=500
begin
account = Account.default
account.transaction do
course = account.courses.create! name: "Big Gradebook"
e = course.enroll_teacher(User.find(1))
@cmatheson
cmatheson / toggle-class-cache.sh
Last active December 22, 2015 08:09
toggle rails class caching in canvas
function toggle-class-cache() {
cfg=config/environments/development-local.rb
if grep -q config.cache_classes $cfg; then
sed -i '
/config.cache_classes/ s/true/false/
t
s/false/true/' \
config/environments/development-local.rb
else
echo "config.cache_classes = false" > $cfg
(ns irc-proxy.core
(:require [clojure.core.async :as async :refer :all]))
(def c (chan))
(def quit (chan))
(defn -main []
(go
(while true
(if-let [v (<! c)]