Skip to content

Instantly share code, notes, and snippets.

View jperras's full-sized avatar
💨
what what is this where am I

Joël Perras jperras

💨
what what is this where am I
View GitHub Profile
@jperras
jperras / .vimrc
Last active September 10, 2020 15:12
Useful vim plugins
scrooloose/nerdcommenter
jreybert/vimagit
tpope/vim-fugitive
airblade/vim-gitgutter
tpope/vim-abolish
tpope/vim-unimpaired
sbdchd/neoformat
junegunn/fzf
junegunn/fzf.vim
sheerun/vim-polyglot

Keybase proof

I hereby claim:

  • I am jperras on github.
  • I am jperras (https://keybase.io/jperras) on keybase.
  • I have a public key ASCVivxJMcbrFE90EG9HP9m-8n2c6R4QT9RupAR8allhRgo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am jperras on github.
  • I am jperras (https://keybase.io/jperras) on keybase.
  • I have a public key ASA-OCKAnBMfI7bTurWTNXXubHO0YbTY91T5W_OH6mir6wo

To claim this, I am signing this object:

@jperras
jperras / approximate_subset_sum.py
Last active December 16, 2017 13:17
Approximate Subset Sum
# -*- coding: utf-8 -*-
import itertools
import operator
def trim(data, delta):
"""Trims elements within `delta` of other elements in the list."""
output = []
@jperras
jperras / slugify.py
Created July 10, 2013 15:34
Generate an ASCII-only slug based off of a unicode string.
from unidecode import unidecode
# Regular expression to match most "punctuation"
punctuation_re = re.compile(r'[\t !"#$%&\'()*\-/<=>?@\[\\\]^_`{|},.]+')
def slugify(text, delimiter=u'-'):
"""Generates an ASCII-only slug."""
result = []
for word in punctuation_re.split(text.lower()):
import re
version_pattern = re.compile(r"/v(?P<version>[0-9a-z\-\+\.]+)", re.IGNORECASE)
class VersionedAPIMiddleware(object):
"""
Allows a Werkzeug/Flask application to have a versioned API.
This middleware will extract out the API version specification in a URL
@jperras
jperras / deb-control.sh
Created May 14, 2012 18:17
For when you need to dive into a .deb and edit the control file.
#!/bin/bash
if [[ -z "$1" ]]; then
echo "Syntax: $0 debfile"
exit 1
fi
DEBFILE="$1"
TMPDIR=`mktemp -d /tmp/deb.XXXXXXXXXX` || exit 1
OUTPUT=`basename "$DEBFILE" .deb`.modified.deb
@jperras
jperras / gist:1770763
Created February 8, 2012 16:09 — forked from markstory/gist:1770613
jenkins json url for getting people who broke the build.
http://jenkins/view/Radiator/api/json?tree=jobs[name,color,buildable,healthReport[description,score,iconUrl],builds[culprits[fullName],changeSet[items[msg]]]]
@jperras
jperras / initialize.pp
Created January 17, 2012 19:25
Initialization puppet script for puppetmasterless puppet setup.
user { "git":
home => "/var/git",
ensure => present
}
file {
"/var/git":
ensure => directory,
owner => "git",
group => "git",
@jperras
jperras / omgwtfbbq.txt
Created January 17, 2012 15:34
Beer Wish List
- Any of the "Armand Seasonal" (Lente, Printemps, Hiver, Été)
- Any Westvleteren (the 12 being the best, but hardest to find)
- HORALs Oude Geuze Mega Blend
- Struiselensis
If none of the above are findable, then nearly any beer by Cantillon:
- Cantillon Blåbær Lambik
- Cantillon Kriek Lambic
- Cantillon Gueuze Lambic