Skip to content

Instantly share code, notes, and snippets.

View .vimrc
" 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 Nov 21, 2015
A must-have if you use Git everyday.
View gut.git
alias gut=git
View keybase.md

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 Aug 29, 2015
Sublime Text settings
View Preferences.sublime-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,
View random_color.py
'#{:06x}'.format(random.randint(0, 0xffffff))
View dispatch.py
from shutil import move
from glob import glob
from os import path
from collections import Counter
HOME = '/home/evuez/'
RESERVED = ('QUEUED', 'TMP', 'DONE')
View hex_to_rgb.py
# 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 Apr 17, 2015
Lighten a color
View lighten.py
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 Aug 29, 2015
Mongoid errors
View en.yml
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 Nov 29, 2017
Donut chart generator
View donutchart.rb
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 = ''