Skip to content

Instantly share code, notes, and snippets.

Go Bootcamp

All of the course material is open source and available here. I took the 3 day language class. You can find the agenda here.

Highlights

Slices of Slices

Slices of slices behave a little differently than I expected.

@qerub
qerub / lifx-sunrise-simulator.rb
Last active September 9, 2020 11:44
LIFX Sunrise Simulator
require "lifx" # http://www.rubydoc.info/gems/lifx
def calculate_color(i) # 0 <= i <= 1
h = [40 * 2 * i, 40].min # will be 40 (yellow) at i=1/2 and stay there
s = 1.0 - [(i - 0.5) * 2, 0].max # will be 1 until i=1/2 and then go down to 0
b = i
LIFX::Color.hsbk(h, s, b, LIFX::Color::KELVIN_MIN)
end
duration = 10 * 60 # seconds
1.9.3:knife-rackspace [master]$ git config --add remote.upstream.fetch "+refs/pull/*/head:refs/remotes/upstream/pr/*"
1.9.3:knife-rackspace [master]$ git fetch upstream
remote: Counting objects: 481, done.
remote: Compressing objects: 100% (223/223), done.
remote: Total 393 (delta 191), reused 309 (delta 113)
Receiving objects: 100% (393/393), 45.29 KiB, done.
Resolving deltas: 100% (191/191), completed with 20 local objects.
From https://github.com/opscode/knife-rackspace
* [new ref] refs/pull/0/head -> upstream/pr/0
* [new ref] refs/pull/1/head -> upstream/pr/1
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active November 5, 2024 18:44
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@krames
krames / git Prompt
Last active September 24, 2015 21:37
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
function proml {
case $TERM in
xterm*)