Skip to content

Instantly share code, notes, and snippets.

import Jimp from "jimp";
const imageUrl = 'https://i.scdn.co/image/ab67616d00001e02e8b066f70c206551210d902b';
const outputImagePath = './output.jpg';
type RGB = [number, number, number];
type ColorMapping = { [color: string]: RGB };
// Colors mapping to their RGB values
const predefinedColors: ColorMapping = {
import Jimp from 'jimp';
// const imageUrl = 'https://i.scdn.co/image/ab67616d00001e02e8b066f70c206551210d902b';
// const imageUrl = 'https://i.scdn.co/image/ab67616d00001e02921f7aa6349a070b6f26b3ff';
// const imageUrl = 'https://i.scdn.co/image/ab67616d0000b2734f70220d934183ce2db16d6a';
const imageUrl = 'https://i.scdn.co/image/ab67616d00001e022eae3ae708586c21b6eee710';
const outputImagePath = './output.jpg';
type RGB = [number, number, number];
type Grayscale = number;
import {encode} from "uqr"
let message = 'Lorem'
const {data: matrix} = encode(message)
function getSafeMatrixItemFlag(matrix: Array<Array<boolean>>, i: number, j: number): boolean {
if (!matrix[i]) {
return false
}
function bitsToCharacter(bits: string): string {
console.assert(bits.match(/^[01]{6}$/) !== null, 'Bits must only contain 6 0 and 1 characters (width is 2 and height is 3)')
return String.fromCharCode(parseInt(bits.split('').reverse().join(''), 2) + 32)
}
@quentint
quentint / wsl2-lando-phpstorm.md
Last active May 1, 2024 17:38
WSL2 / Lando / PhpStorm

This guide aims to be the reference for setting up Lando and PhpStorm tools on a WSL2 environment.

This assumes your project:

  • lives in a WSL2 instance (something like \\wsl$\Ubuntu\home\[user]\dev\my-demo-project)
  • Is "Lando-initialized" (lando init) and runs (lando start)
  • uses Composer, and dependencies are installed (lando composer install)

Docker

This guides relies on Docker for Windows, using the WSL2 based engine, and setup with WSL integration (Resources &gt; WSL Integration). Unfortunately I didn't find a solution to do without it and only rely on WSL's Docker.

@quentint
quentint / wsl2-lando.md
Created March 2, 2023 13:21
Windows WSL2: Install Lando 3.11.0

All of this happens in WSL2/Ubuntu.

Install Docker (latest Lando-supported version)

sudo apt-get update
VERSION_STRING=5:20.10.23~3-0~ubuntu-bionic
sudo apt-get install docker-ce=$VERSION_STRING docker-ce-cli=$VERSION_STRING containerd.io docker-buildx-plugin docker-compose-plugin
@quentint
quentint / windows-wsl2-docker-lando-php-xdebug.md
Created October 17, 2022 09:02 — forked from rockschtar/windows-wsl2-docker-lando-php-xdebug.md
Windows 10/11 + WSL2 + Docker + Lando + PHP XDebug (PHPStorm, IntelliJ & Visual Studio Code (vscode))
  1. Install WSL
  2. Install your preferred WSL Linux Distro vom Microsoft Store. In my case I used Ubuntu 20.04.
  3. Install Docker for Windows
  4. Enable Docker WSL2 Integration image
  5. Install Lando inside WSL
wget https://github.com/lando/lando/releases/download/v3.6.0/lando-x64-v3.6.0.deb
dpkg -i --ignore-depends=docker-ce lando-x64-v3.6.0.deb
@quentint
quentint / xdebug.md
Created August 5, 2022 13:23
Xdebug config for Lando running in WSL2 and PhpStorm running in Windows
@quentint
quentint / EnumConfigurator.php
Last active July 25, 2022 13:30
EasyAdmin EnumField
<?php
namespace App\Form\Field\Configurator;
use App\Form\Field\EnumField;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext;
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldConfiguratorInterface;
use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto;
use EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto;