Skip to content

Instantly share code, notes, and snippets.

const udg = 'https://upload.wikimedia.org/wikipedia/commons/thumb/5/5f/Escudo_UdeG.svg/1200px-Escudo_UdeG.svg.png'
let img = document.createElement('img');
let canvas = document.createElement('canvas');
let pixels = []
img.onload = function() {
canvas.width = img.width/4;
canvas.height = img.height/4;
canvas.getContext('2d').drawImage(img, 0, 0, img.width / 4, img.height / 4);
pixels = canvas.getContext('2d').getImageData(0, 0, img.width / 4, img.height / 4).data;

-- phonesim.nix (phonesim module)

{ config, pkgs, lib, ... }:

with lib;

let

  port = "12345";
https://drive.google.com/file/d/1FgKTk_sEMl6XkfBNQtJ0wwxk6zBOm3H0/view?usp=sharing
https://drive.google.com/file/d/19WWCj4bWI8UP0PrKsDF-NdAkh50ToKox/view?usp=sharing
https://drive.google.com/file/d/1QTVlKfSzDyj3hynuhVxLlJ58OxqraBYw/view?usp=sharing
https://mega.nz/file/L6w2SSpI#jzDYyJhQsLwiqdfQwJ3J0mAcUFfiHg0a_LdJz_sVpw4
https://ots-list.org/download
@LaloHao
LaloHao / password.sh
Last active February 28, 2021 01:45
Generate N password(s), each one having X alphanumeric length
# Generate 10 passwords, each one having 80 alphanumeric characters
X=80 N=10; cat /dev/urandom | tr -dcs '[:alnum:]' - | fold -w "$X" | head -n "$N"
# Generate 10 passwords, each one having 80 alphanumeric characters with at least one of the symbols in '!$%@^&*'
X=80 N=10; cat /dev/urandom | tr -dcs '[:alnum:]!$%@^&*' - | fold -w "$X" | grep '\(!\|$\|#\|%\|@\|^\|&\|*\)' | head -n "$N"
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
stdenv.mkDerivation {
name = "transset-df";
version = "6.0.0";
src = builtins.fetchTarball {
url = "https://forchheimer.se/transset-df/transset-df-6.tar.gz";
sha256 = "0rfak8bjvmg3njj4n6xncn74p7k3rj1x0vcsbg15nkdnqpjjsbpa";
};
buildInputs = [
@LaloHao
LaloHao / btfo.js
Last active September 3, 2021 19:05
Disable smooth trolling (scrolling) on websites
// source: http://stackoverflow.com/a/35611393/992504
document.addEventListener("wheel", event => event.stopPropagation(), true);
// document.addEventListener("wheel", event => event.stopPropagation(), { capture: true });
/*
document.getElementsByTagName("body")[0].addEventListener("wheel",function (event) {
// exception for ACE Editor, JS text editor used by sites like GitHub
if (event.target.classList.contains('ace_content')) {
return;
@LaloHao
LaloHao / letters
Created October 18, 2020 16:54
Unicode enriched text
Text
ABCDEFGHIJKLMNÑOPQRSTUVWXYZ
abcdefghijklmnñopqrstuvwxyz
0123456789
Bold (serif)
𝐀𝐁𝐂𝐃𝐄𝐅𝐆𝐇𝐈𝐉𝐊𝐋𝐌𝐍𝐍̃𝐎𝐏𝐐𝐑𝐒𝐓𝐔𝐕𝐖𝐗𝐘𝐙
𝐚𝐛𝐜𝐝𝐞𝐟𝐠𝐡𝐢𝐣𝐤𝐥𝐦𝐧𝐧̃𝐨𝐩𝐪𝐫𝐬𝐭𝐮𝐯𝐰𝐱𝐲𝐳
𝟎𝟏𝟐𝟑𝟒𝟓𝟔𝟕𝟖𝟗
@LaloHao
LaloHao / compiler.nix
Created October 17, 2020 22:00
Pic development
let
pkgs = import <nixpkgs> {
config = {
allowUnfree = true;
};
};
inherit (pkgs) sdcc gputils automake;
in
sdcc.overrideAttrs(o: rec {
inherit gputils;
@LaloHao
LaloHao / printer.lisp
Last active October 11, 2020 03:42
Why is a Common-Lisp Lambda expression a valid function name?
<i>[hao@wendy:~]$ ecl
;;; Loading "/nix/store/j48bf40ssnzgil3qmdc759y0navk079d-ecl-readline/lib/init.lsp"
n;;; Loading "/nix/store/j48bf40ssnzgil3qmdc759y0navk079d-ecl-readline/lib/ecl-readline.fas"
ix-;;; Loading "/nix/store/j48bf40ssnzgil3qmdc759y0navk079d-ecl-readline/lib/ecl-completions.fas"
sECL (Embeddable Common-Lisp) 16.1.3 (git:UNKNOWN)
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2000 Juan J. Garcia-Ripoll
Copyright (C) 2016 Daniel Kochmanski
ECL is free software, and you are welcome to redistribute it