Skip to content

Instantly share code, notes, and snippets.

View Marcellofabrizio's full-sized avatar
:shipit:

Marcello Fabrizio Marcellofabrizio

:shipit:
View GitHub Profile
@peacefixation
peacefixation / lerp-rgb.js
Last active August 1, 2023 10:01
Linear interpolate RGB colors
// interpolate between colors { r, g, b } where 0 < t < 1
// when assigning a color for a number in a range larger than 0-1, scale the number to the 0-1 range first
function lerpRGB(color1, color2, t) {
let color = {};
color.r = color1.r + ((color2.r - color1.r) * t);
color.g = color1.g + ((color2.g - color1.g) * t);
color.b = color1.b + ((color2.b - color1.b) * t);
return color;
}
package main
import (
agwd "github.com/sclevine/agouti"
tbwd "github.com/tebeka/selenium"
"log"
sgwd "sourcegraph.com/sourcegraph/go-selenium"
)
// Helper for sourcegraph/go-selenium

Kafka installation with systemd

0. Create kafka user

sudo adduser kafka
sudo adduser kafka sudo
su -l kafka

1. Download and Install kafka archive

@izy521
izy521 / objectdeepcopy.js
Created July 30, 2016 17:28
`JSON.parse( JSON.stringify( obj) )` has been regarded as the fastest method for deep copying Objects, but is it? This is mainly just to test. Obviously Functions aren't allowed in JSON.
var Types = new Map();
Types.set(Array, function(v) {
var l = v.length; i = 0, a = Array(l);
for (i; i<l; i++) {
a[i] = v[i];
}
return a;
});
Types.set(Number, function(v) {
return v * 1;
@brunodoamaral
brunodoamaral / _dice.py
Last active March 16, 2024 18:00 — forked from JDWarner/_dice.py
Dice coefficient between two boolean NumPy arrays or array-like data. This is commonly used as a set similarity measurement (though note it is not a true metric; it does not satisfy the triangle inequality). The dimensionality of the input is completely arbitrary, but `im1.shape` and `im2.shape` much be equal. This Gist is licensed under the mod…
def dice(im1, im2, empty_score=1.0):
"""
Computes the Dice coefficient, a measure of set similarity.
Parameters
----------
im1 : array-like, bool
Any array of arbitrary size. If not boolean, will be converted.
im2 : array-like, bool
Any other array of identical size. If not boolean, will be converted.
Returns
@subfuzion
subfuzion / curl.md
Last active September 23, 2024 15:27
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@bieniekmateusz
bieniekmateusz / factorial.asm
Created October 6, 2012 19:35
Factorial function in assembly language
; The input is a decimal number,
; Result is a hexadecimal number
section .text
; to make the printf out work the main 'method' is needed
global main
; for printing numbers out
extern printf