Skip to content

Instantly share code, notes, and snippets.

@evuez
evuez / .vimrc
Created November 30, 2015 08:34
" This must be first, because it changes other options as a side effect.
set nocompatible
" Make backspace behave in a sane manner.
set backspace=indent,eol,start
" Switch syntax highlighting on
syntax on
" Enable file type detection and do language-dependent indenting.
@evuez
evuez / gut.git
Created November 21, 2015 18:45
A must-have if you use Git everyday.
alias gut=git

Keybase proof

I hereby claim:

  • I am evuez on github.
  • I am evuez (https://keybase.io/evuez) on keybase.
  • I have a public key whose fingerprint is E479 FF82 83B8 A866 B27B 336E 9D07 6AF6 6BFA E24A

To claim this, I am signing this object:

@evuez
evuez / Preferences.sublime-settings
Last active August 29, 2015 14:22
Sublime Text settings
// Settings in here override those in "Default/Preferences.sublime-settings",
// and are overridden in turn by file type specific settings.
{
// Columns in which to display vertical rulers
"rulers": [78],
// Set to true to draw a border around the visible rectangle on the minimap.
// The color of the border will be determined by the "minimapBorder" key in
// the color scheme
"draw_minimap_border": true,
'#{:06x}'.format(random.randint(0, 0xffffff))
from shutil import move
from glob import glob
from os import path
from collections import Counter
HOME = '/home/evuez/'
RESERVED = ('QUEUED', 'TMP', 'DONE')
@evuez
evuez / hex_to_rgb.py
Last active August 29, 2015 14:19
Hex to RGB
# Python 2
def hex_to_rgb(hex_):
return unpack('BBBB', hex_.decode('hex'))
# Python 3
def hex_to_rgb(hex_):
import codecs
return unpack('BBBB', codecs.decode(hex_, 'hex'))
@evuez
evuez / lighten.py
Created April 17, 2015 06:26
Lighten a color
def lighten(color, scale=1.0):
"""
Lighten a color.
- color must be a tuple (r, g, b, a)
- scale can be any number, if < 1, color will be darkened
"""
return map(
lambda x: int(min(max(x * scale, 0), 255)),
color[:3]
) + list(color[3:])
@evuez
evuez / en.yml
Last active August 29, 2015 14:17
Mongoid errors
en:
mongoid:
errors:
messages:
blank_in_locale:
"can't be blank in %{location}"
ambiguous_relationship:
message: "Ambiguous relations %{candidates} defined on %{klass}."
summary:
"When Mongoid attempts to set an inverse document of a relation
@evuez
evuez / donutchart.rb
Last active November 29, 2017 10:12
Donut chart generator
def donut(data, size, thickness, background='#fff')
cx = cy = size / 2
radius = size / 2 - 2
sum = data.values.inject(:+)
dx = 0
dy = -radius
angle = -90
paths = ''