Skip to content

Instantly share code, notes, and snippets.

View lattice0's full-sized avatar
🦀

Lattice 0 lattice0

🦀
View GitHub Profile

OK, so today I was looking at Writer monad, a very basic Monad.

In its essence, it's just a Monad that outputs (e.g. log) something,
The "Variation three: Output" Monad from the original Monads for functional programming, 92 paper is very lean:

type M a = (Output, a)
type Output = String
@lattice0
lattice0 / gist:c23561ff62af5647c4ac0f3d8d26a739
Last active March 28, 2024 06:29
Vstarcam raspberry pi IP finder and HTTP port
#Give an IP address in the range of the camera to the eth0 interface
sudo ip address add 192.168.1.133/24 dev eth0
#First, scan the eth0 interface to find all the IPs connected to it
nmap -e eth0 192.168.1.0/24
#Now that you found the camera's IP, scan which ports are open to find the HTTP port (suupose the IP is ...189)
nmap -e eth0 192.168.1.104 -p 0-65535
#SSH and foward the HTTP port of the discovered camera
@XueshiQiao
XueshiQiao / h264format.md
Last active February 26, 2023 15:44
H.264 Annex B format and AVCC format

AnnexB format:

([start code] NALU) | ( [start code] NALU) |

AVCC format:

([extradata]) | ([length] NALU) | ([length] NALU) |
@Jim-Bar
Jim-Bar / YUV_formats.md
Last active June 19, 2024 16:55
About YUV formats

About YUV formats

First of all: YUV pixel formats and Recommended 8-Bit YUV Formats for Video Rendering. Chromium's source code contains good documentation about those formats too: chromium/src/media/base/video_types.h and chromium/src/media/base/video_frame.cc (search for RequiresEvenSizeAllocation(), NumPlanes() and those kinds of functions).

YUV?

You can think of an image as a superposition of several planes (or layers in a more natural language). YUV formats have three planes: Y, U, and V.

Y is the luma plane, and can be seen as the image as grayscale. U and V are reffered to as the chroma planes, which are basically the colours. All the YUV formats have these three planes, and differ by the different orderings of them.

@DD3Boh
DD3Boh / gist:6c51fd3c5f91b1042e956771483714de
Created July 19, 2017 14:59
How to merge a newer CAF tag in an android kernel
First go here:
https://wiki.codeaurora.org/xwiki/bin/QAEP/release
This site gives information about all msm soc release details with tag + android version
Search your msm here.. Check the latest one and look for correct android version and mark that tag.
Now open one of the following links (dependent on your linux kernel version)
@crearo
crearo / fragment_shader_NV12_to_RGB.frag
Last active June 26, 2024 07:38
A fragment shader to convert NV12 to RGB.
/** A fragment shader to convert NV12 to RGB.
* Input textures Y - is a block of size w*h.
* texture UV is of size w*h/2.
* Remember, both U and V are individually of size w/2*h/2, but they are interleaved.
* The layout looks like this :
* ----------
* | |
* | Y | size = w*h
* | |
* |________|
@jpouellet
jpouellet / qvm-port-forward.sh
Last active February 1, 2024 12:50
Forwards a specified port to a specified VM, auto-detecting its NetVM chain. (Qubes OS)
#!/bin/sh
# Inspired by https://gist.github.com/daktak/f887352d564b54f9e529404cc0eb60d5
ip() { qvm-ls --raw-data ip -- "$1"; }
netvm() { qvm-prefs -g -- "$1" netvm; }
forward() {
local from_domain=$1
local to_domain=$2
@dleonard00
dleonard00 / explode-opvn.sh
Created January 15, 2017 07:31
extract the certificate and key from an .ovpn file
#!/bin/bash
# This script will extract the certificate and key from an .ovpn file
# into their own files, which makes it possible to use them to configure
# the VPN using Ubuntu's network manager
# Usage example:
# >> ovpnconvert username.dev.ovpn
# You can keep following these instructions here:
@vinicius73
vinicius73 / post.md
Created November 22, 2016 12:26
["LÓGICA DE PROGRAMAÇÃO" É BOBAGEM, e explicarei porquê.]

#["LÓGICA DE PROGRAMAÇÃO" É BOBAGEM, e explicarei porquê.]

Se preparem que o texto é longo.

Várias vezes chegam novatos aqui perguntando como começar, e a galera diz "estuda lógica primeiro, depois vai pra linguagem X". Vivo dizendo que é bobagem. Ontem, em particular, falei isso, e vieram várias pessoas por inbox me perguntar porquê (e uma pra me xingar, achando que falei por arrogância).

Pra facilitar, eu vou escrever uma boa explicação de porquê "lógica de programação" é furada, doa a quem doer, e postar na APDA e no fórum da EnergyLabs (para futuras referências, porque esse assunto vai voltar, ctz).

@btroncone
btroncone / rxjs_operators_by_example.md
Last active June 15, 2024 07:17
RxJS 5 Operators By Example