Skip to content

Instantly share code, notes, and snippets.

View DAddYE's full-sized avatar

Davide D'Agostino DAddYE

  • Uber
  • San Francisco
View GitHub Profile
@DAddYE
DAddYE / chan.go
Created September 13, 2014 08:35
Infinitely Buffered Channel
/*
This is an infinitely buffered channel.
*/
package main
import (
"fmt"
"sync"
"time"
)
@DAddYE
DAddYE / designer.html
Created August 11, 2014 06:49
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<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-menu/core-submenu.html">
<link rel="import" href="../chart-js/chart-js.html">
<polymer-element name="my-element">
@DAddYE
DAddYE / designer.html
Created July 27, 2014 09:02
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<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-menu/core-submenu.html">
<link rel="import" href="../chart-js/chart-js.html">
<polymer-element name="my-element">

Partition hard drives

Use cfdisk command to create partitions. If you have 1 disk only, you need (at least) 2 partitions:

  1. Boot (/dev/sda1)
  2. Root (/dev/sda2)

Format hard drives

mkfs.ext4 /dev/sda1

// Credits: https://news.ycombinator.com/item?id=7735973
pc, _, line, _ := runtime.Caller(1)
name := runtime.FuncForPC(pc).Name()
# vim: ft=ruby
PLUGINS = %w[
pry-rails
pry-doc
pry-git
pry-stack_explorer
pry-remote
pry-debugger
hirb

Learn you a Haskell - In a nutshell

This is a summary of the "Learn You A Haskell" online book under http://learnyouahaskell.com/chapters.


1. Introduction

  • Haskell is a functional programming language.
class HTTPRouter
self()
self.routes = { }
end
add(verb = String, path = String, func = Function)
self.routes[#self.routes + 1] = Route(verb, path, func)
end
match(verb, path)
for i=1, #self.routes do
m, q = self.routes[i].match(verb, path)

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results

@DAddYE
DAddYE / gist:8721292
Created January 30, 2014 22:22 — forked from tmm1/gist:8393897
Ruby 2.1.0 in Production: known bugs and patches
Last week, we upgraded the github.com rails app to ruby 2.1.0 in production.
While testing the new build for rollout, we ran into a number of bugs. Most of
these have been fixed on trunk already, but I've documented them below to help
anyone else who might be testing ruby 2.1 in production.
@naruse I think we should backport these patches to the ruby_2_1 branch and
release 2.1.1 sooner rather than later, as some of the bugs are quite critical.
I'm happy to offer any assistance I can to expedite this process.