Skip to content

Instantly share code, notes, and snippets.

@avishayp
avishayp / Dockerfile
Created September 25, 2018 19:02
Add non-root user for alpine linux
# non root user example for alpine
#
# usage:
# $ docker build --build-arg "USER=someuser" --tag test .
# $ docker run --rm test
FROM alpine
ARG USER=default
ENV HOME /home/$USER
@i2000s
i2000s / jekyll-tikz.rb
Created November 4, 2017 09:12 — forked from AlexBobkov/jekyll-tikz.rb
Jekyll-tikz is a Jekyll plugin which helps you use Tikz in you Jekyll site.
# Authored my Maxfan http://github.com/Maxfan-zone http://maxfan.org
# This is used to convert tikz code into svg file and load in you jekyll site
#
# Install:
#
# 1. Copy this file in your _plugins/ directory. You can customize it, of course.
# 2. Make sure texlive and pdf2svg are installed on your computer.
# 3. Set path to pdf2svg in _config.yml in "pdf2svg" variable
#
# Input:
@SinBirb
SinBirb / check_darkmode.js
Created October 26, 2017 16:37
Heuristic to check whether a site appears dark or bright to a user
/* round num to c digits */
function round(num, c) {
return +(Math.round(num + "e+" + c) + "e-" + c);
}
/* Adapted from Python from manojpandey, thanks!
https://gist.github.com/manojpandey/f5ece715132c572c80421febebaf66ae
*/
function rgbTolab(inputColor) {
@dschep
dschep / raspbian-python3.6.rst
Last active October 24, 2023 14:57 — forked from BMeu/raspbian-python3.5.rst
Installing Python 3.6 on Raspbian

Installing Python 3.6 on Raspbian

As of January 2018, Raspbian does not yet include the latest Python release, Python 3.6. This means we will have to build it ourselves, and here is how to do it. There is also an ansible role attached that automates it all for you.

  1. Install the required build-tools (some might already be installed on your system).

@alastairparagas
alastairparagas / TripleIntegralsCylindricalSpherical.ipynb
Last active November 12, 2016 22:25
Triple Integral Plotting in iPython
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@manojpandey
manojpandey / rgb2lab.py
Created August 12, 2016 10:34
RGB to CIELab color space conversion
# RGB to Lab conversion
# Step 1: RGB to XYZ
# http://www.easyrgb.com/index.php?X=MATH&H=02#text2
# Step 2: XYZ to Lab
# http://www.easyrgb.com/index.php?X=MATH&H=07#text7
def rgb2lab(inputColor):
@popcorn245
popcorn245 / hue_colors.md
Last active December 10, 2023 03:10
XY Color Conversion

FROM HUE DESIGN DOCS

https://github.com/PhilipsHue/PhilipsHueSDK-iOS-OSX/blob/00187a3db88dedd640f5ddfa8a474458dff4e1db/ApplicationDesignNotes/RGB%20to%20xy%20Color%20conversion.md

#Conversion between RGB and xy in the CIE 1931 colorspace for hue The conversion between RGB and xy in the CIE 1931 colorspace is not something Philips invented, but we have an optimized conversion for our different light types, like hue bulbs and LivingColors. It is important to differentiate between the various light types, because they do not all support the same color gamut. For example, the hue bulbs are very good at showing nice whites, while the LivingColors are generally a bit better at colors, like green and cyan.

@AmrEldib
AmrEldib / git.lua
Created February 29, 2016 05:33
Customize Windows Cmder Prompt
---
-- Find out current branch
-- @return {false|git branch name}
---
function get_git_branch()
for line in io.popen("git branch 2>nul"):lines() do
local m = line:match("%* (.+)$")
if m then
return m
end
@Fighter19
Fighter19 / steamcon.c
Last active October 23, 2016 04:19
Accessing the Steam Controller through libusb; Attempt of reversing the protocol.
//Do what you want with this example
//Author: Fighter19
//Comment: I used Wireshark to get most of the values
#include <sys/ioctl.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ynsta
ynsta / json2vdf.py
Last active September 25, 2017 22:03
Steam vdf/json converters
#!/usr/bin/env python
import json
def json2vdf(stream):
"""
Read a json file and return a string in Steam vdf format
"""