Skip to content

Instantly share code, notes, and snippets.

View sveetch's full-sized avatar
🥝
I'm a kiwi

David THENON sveetch

🥝
I'm a kiwi
View GitHub Profile
@czpython
czpython / serialize_filer.py
Last active March 3, 2024 14:22
create fixture of django filer
from django.core import serializers
from django.db.models import get_app, get_models
from django.db.models.query import QuerySet
def export_filer_models(output_file=None):
"""
Exports filer models to output_file.
"""
app = get_app('filer')
@jdiscar
jdiscar / gist:9144764
Last active November 11, 2020 06:07
RGB Value to Nearest Color Name (Python)
"""
Original Author Ernesto P. Adorio, Ph.D
Original Source: http://my-other-life-as-programmer.blogspot.com/2012/02/python-finding-nearest-matching-color.html
Modifed By: JDiscar
This class maps an RGB value to the nearest color name it can find. Code is modified to include
ImageMagick names and WebColor names.
1. Modify the minimization criterion to use least sum of squares of the differences.
2. Provide error checking for input R, G, B values to be within the interval [0, 255].
@sloria
sloria / bobp-python.md
Last active May 1, 2024 08:37
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: