Skip to content

Instantly share code, notes, and snippets.

View zmalltalker's full-sized avatar

Marius Mathiesen zmalltalker

View GitHub Profile
@zmalltalker
zmalltalker / prompt.zsh
Created September 29, 2016 07:40
Marius sin Zsh prompt
# Interesting variables:
# - $COLUMNS: how wide are we?
# - $SECONDS: how long have we been running
# %#: root will have #, others will have %
autoload -U colors
setopt prompt_subst
module TimeoutFork
def self.run(command, timeout=2)
if child_pid = fork
sleep timeout
Process.kill("KILL", child_pid)
yield
else
exec command
end
end

High level

Graph/log

All commits have at least one parent. Commits with more than one parent are called merge commits The child/parent relationship are visualized as train tracks

All Git repositories were created equal

Exactly the same contents. No difference between server versions and local versions.

Remotes

Remotes are other clones of your repository, served via a URL

Keybase proof

I hereby claim:

  • I am zmalltalker on github.
  • I am zmalltalker (https://keybase.io/zmalltalker) on keybase.
  • I have a public key whose fingerprint is 9DCD 1B09 6788 95F6 59B5 E243 18AA 0E77 CBDD 65C9

To claim this, I am signing this object:

@zmalltalker
zmalltalker / gist:35ccba89b963caeac8e1
Created September 9, 2014 10:48
An introduction to Go
The October GDG meetup will give an introduction to programming
in Go. In the first half of the session Marius Mathiesen will give a brief
introduction to the language's core features.
In the second half Thomas Kjeldahl Nilsson will guide us through
a real-world example of using Go, a small tool he uses in his
day-to-day work.
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../paper-input/paper-input.html">
<polymer-element name="my-element">
<template>
<style>
:host {
@zmalltalker
zmalltalker / gist:8558407
Created January 22, 2014 13:08
Convert image asset to Android *dpi versions
require "pathname"
require "fileutils"
original = "{query}"
original_path = Pathname(original)
command = "sips -g pixelWidth #{original}"
output = `#{command}`
size = output.split("\n").last.split(/\s/).last.to_i
@zmalltalker
zmalltalker / server.rb
Created July 5, 2013 11:40
HTTP 100 continue with wget
require "socket"
server = TCPServer.new("0.0.0.0", 9999)
count = 0
loop do
count = count + 1
client = server.accept
req = client.readline
client.readline
@zmalltalker
zmalltalker / install_gitorious_shim.sh
Created July 4, 2013 12:39
Create a Gitorious binary shim
#!/bin/sh
GITORIOUS_ROOT=$HOME/Projects/gitorious/gitorious
CHRUBY=/usr/local/share/chruby/chruby.sh
RUBY_VERSION=$GITORIOUS_ROOT/.ruby-version
GITORIOUS_BIN=/tmp/installer/gitorious
cat << EOF > $GITORIOUS_BIN
#!/bin/sh
if [ -f $CHRUBY ]; then
@zmalltalker
zmalltalker / gist:5900206
Last active November 3, 2016 12:59
Install ruby-install, chruby and ruby 1.9.3 on Centos - Install puppet - Run `puppet apply <(curl -S https://gist.github.com/zmalltalker/5900206/raw/b9d7c2263cef981a8384a4e2b513e67c70060436/gistfile1.pp)`
# chruby
# ruby-install
# ruby 1.9.3
# /etc/profile.d/chruby.sh
Exec {
path => ["/bin","/usr/bin", "/usr/local/bin"]
}
file { "/etc/profile.d/chruby.sh":
ensure => present,