Skip to content

Instantly share code, notes, and snippets.

@error454
error454 / gist:6b94c46d1f7512ffe5ee
Last active May 14, 2020 22:17
Convert RGB to CIE Color Space
import math
# This is based on original code from http://stackoverflow.com/a/22649803
def EnhanceColor(normalized):
if normalized > 0.04045:
return math.pow( (normalized + 0.055) / (1.0 + 0.055), 2.4)
else:
return normalized / 12.92
def RGBtoXY(r, g, b):
@PaulFurtado
PaulFurtado / usb_reset.py
Last active August 9, 2023 13:46
Reset USB device from python
"""
Example code for resetting the USB port that a Teensy microcontroller is
attached to. There are a lot of situations where a Teensy or Arduino can
end up in a bad state and need resetting, this code is useful for
"""
import os
import fcntl
import subprocess
@qguv
qguv / solarized-dark.css
Last active April 5, 2021 04:50 — forked from nicolashery/solarized-dark.css
Solarized theme for Jekyll, updated to reflect toned-down line numbers
/* Solarized Dark
For use with Jekyll and Pygments
http://ethanschoonover.com/solarized
SOLARIZED HEX ROLE
--------- -------- ------------------------------------------
base03 #002b36 background
base01 #586e75 comments / secondary content
@TrevorBurnham
TrevorBurnham / git-good.md
Last active October 24, 2019 12:30
Git Good Practices: A Totally Uncontroversial Guide

Know what changes you're making, every step of the way

Give yourself as many chances as you can to catch your mistakes before you push them:

  1. Use an editor plugin like Sublime Text's GitGutter so you can always see which parts of a file you've changed. (More precisely, it shows the diff of the file between the working directory and HEAD.)
  2. Not sure whether to stage your unstaged changes? Use git diff with no arguments. It shows the difference between your working directory and the index.
  3. Not sure whether to commit your staged changes? Use git diff --staged. It shows the difference between your index and HEAD.
  4. When you decide to commit, use git commit --verbose, no -m, and take one last look at the changes in your editor. (Make sure it's got a nice Git Commit Message syntax, like the one in the Sublime Text Git package, so the list of changes is nice and colorized.) You can't edit the changes directl
@wolfeidau
wolfeidau / sass_converter.rb
Created May 7, 2011 02:43
Sass plugin for Jekyll
module Jekyll
# Sass plugin to convert .scss to .css
#
# Note: This is configured to use the new css like syntax available in sass.
require 'sass'
class SassConverter < Converter
safe true
priority :low
def matches(ext)
@dtjm
dtjm / haml_converter.rb
Created August 17, 2010 06:07 — forked from radamant/haml_converter.rb
Haml and Sass plugin for Jekyll 0.6.2
module Jekyll
require 'haml'
class HamlConverter < Converter
safe true
priority :low
def matches(ext)
ext =~ /haml/i
end
@defunkt
defunkt / clients.md
Created April 18, 2010 14:09
A list of Gist clients.

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support