Skip to content

Instantly share code, notes, and snippets.

@rsalgado
rsalgado / README.md
Last active August 17, 2020 13:27
SSE Handler Example with Plug and Cowboy 2

SSE Handler Example with Plug and Cowboy 2

To run in the console, without supervision trees, do the following:

$ iex -S mix

iex> Plug.Adapters.Cowboy2.http(NormalRouter, [], [dispatch: PlugDispatch.dispatch()])

To run inside a supervision tree, make sure to call child_spec (or use a tuple) with the correct arguments, like in the following example:

@lubien
lubien / stickers-downloader.js
Last active November 21, 2023 03:06
Download all visible telegram stickers images
// How to download telegram sticker images
/*
1. Go to Telegram Web;
2. Open console (F12);
3. Paste the code below in the console and press Enter;
4. Open your stickers menu and make sure you see the sticker pack you want to download (so Telegram will load it).
5. At the console paste and run "downloadStickers()" any time you want to download a pack.
6. [Convert .webm to another format](http://www.freewaregenius.com/convert-webp-image-format-jpg-png-format/);
7. Happy hacking.
@cdipaolo
cdipaolo / HaversinFormula.go
Created April 15, 2015 01:31
Golang functions to calculate the distance in meters between long,lat points on Earth.
// haversin(θ) function
func hsin(theta float64) float64 {
return math.Pow(math.Sin(theta/2), 2)
}
// Distance function returns the distance (in meters) between two points of
// a given longitude and latitude relatively accurately (using a spherical
// approximation of the Earth) through the Haversin Distance Formula for
// great arc distance on a sphere with accuracy for small distances
//
@Pro
Pro / NormalizeImage.py
Last active November 30, 2019 10:27
Normalize Image using Lab channel
__author__ = 'Stefan'
__docformat__ = 'restructedtext en'
import numpy as np
import scipy.misc
import skimage.color
import skimage.exposure