Skip to content

Instantly share code, notes, and snippets.

View blopa's full-sized avatar
🏴‍☠️

Pablo Benmaman blopa

🏴‍☠️
View GitHub Profile
@thesamesam
thesamesam / xz-backdoor.md
Last active April 7, 2025 09:15
xz-utils backdoor situation (CVE-2024-3094)

FAQ on the xz-utils backdoor (CVE-2024-3094)

This is a living document. Everything in this document is made in good faith of being accurate, but like I just said; we don't yet know everything about what's going on.

Update: I've disabled comments as of 2025-01-26 to avoid everyone having notifications for something a year on if someone wants to suggest a correction. Folks are free to email to suggest corrections still, of course.

Background

@jabbink
jabbink / Albert Heijn app API.md
Last active April 15, 2025 07:03
Interact with the Albert Heijn mobile app API to retrieve receipt data, and other things

AH API

Always use User-Agent: Appie/8.22.3 and Content-Type: application/json
Technically there is more information about your device and user ID after it, but the server does not seem to care

Token

If you have a valid access_token, add it as a header in request
Authorization: Bearer access_token

@Madmals
Madmals / post_on_githubGist.js
Last active November 22, 2024 22:33
FETCH POST METHOD ON GITHUB GIST
content = {
"description": "TITLE ",
"public": false,
"files":
{
"post1.md": {
"content": "THIS IS WHERE CONTENT WILL BE PUT"
}
}
@privatenumber
privatenumber / light-dark-image.svg
Last active October 22, 2024 05:40
Light/dark mode SVG image
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@igorjs
igorjs / _readme.md
Created October 12, 2020 23:52 — forked from andywer/_readme.md
React - Functional error boundaries

React - Functional error boundaries

Thanks to React hooks you have now happily turned all your classes into functional components.

Wait, all your components? Not quite. There is one thing that can still only be implemented using classes: Error boundaries.

There is just no functional equivalent for componentDidCatch and deriveStateFromError yet.

Proposed solution

@blopa
blopa / Matrix.jsx
Last active February 1, 2025 20:56
Matrix Rain effect with a React functional hooks component
import React, { useEffect, useRef } from 'react';
function MatrixBackground({ timeout = 50 }) {
const canvas = useRef();
useEffect(() => {
const context = canvas.current.getContext('2d');
const width = document.body.offsetWidth;
const height = document.body.offsetHeight;
@mindplay-dk
mindplay-dk / find-var.js
Last active February 29, 2024 09:23
Recursively search the global namespace (window) for a variable with a given name
function findVar(varName) {
let seen = new Map();
function search(obj, prefix = "") {
if (seen.has(obj)) {
return;
}
seen.set(obj, true);
@blopa
blopa / phaser3.sbx
Created December 28, 2019 19:34
Phaser 3 ShoeBox .sbx configuration
::ShoeBox:shoebox.plugin.spriteSheet::PluginCreateSpriteSheet:{
"fileFormatLoop":"\\t{\\n\\t\\t\"filename\":\"@id\", \\n\\t\\t\"frame\": {\"x\":@x, \"y\":@y, \"w\":@w, \"h\":@h},\\n\\t\\t\"anchor\": {\"x\":0,\"y\":1}\\n\\t}@,\\n",
"texCropAlpha":true,
"fileFormatOuter":"{\\n\"frames\": [\\n@loop\\n],\\n\"meta\": {\\n\\t\"size\": {\"w\": @W, \"h\": @H},\\n\\t\"scale\": \"1\"\\n}\\n}",
"useCssOverHack":false,
"fileName":"sprites.js",
"texPadding":1,
"texExtrudeSize":0,
"scale":1,
"renderDebugLayer":false,
# Based on https://baymard.com/checkout-usability/credit-card-patterns
ALL TOGETHER
============
(?:4[0-9]{3}(?:[\ -]?[0-9]{4}){3})|(?:4(?:026|405|508|844|913|917)[-\ ]?[0-9]{4}|4175[-\ ]?00[0-9]{2})(?:[-\ ]?[0-9]{4}){2}|(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)(?:[-\ ]?[0-9]{4}){3}|3[47][0-9]{2}[-\ ]?[0-9]{6}[-\ ]?[0-9]{5}|62[0-9]{2}[-\ ]?(?:[-\ ]?[0-9]{4}){3}|62[0-9]{4}[-\ ]?[0-9]{13}|(?:5[0678][0-9]{2}|6[0-9]{3})[-\ ]?[0-9]{4}[-\ ]?[0-9]{5}|(?:5[0678][0-9]{2}|6[0-9]{3})[-\ ]?[0-9]{6}[-\ ]?[0-9]{5}|(?:5[0678][0-9]{2}|6[0-9]{3})(?:[-\ ]?[0-9]{4}){3}|(?:5[0678][0-9]{2}|6[0-9]{3})(?:[-\ ]?[0-9]{4}){3}[-\ ]?[0-9]{3}|(?:30[0123459][0-9]|3[689][0-9]{2})[-\ ]?[0-9]{6}[-\ ]?[0-9]{4}|5[45][0-9]{2}(?:[-\ ]?[0-9]{4}){3}|(?:6011[-\ ]?[0-9]{4}|6221[-\ ]?2[6-9][0-9]{2}|6221[-\ ]?[3-9][0-9]{3}|622[2-8][-\ ]?[0-9]{4}|6229[-\ ]?[01][0-9]{3}|6229[-\ ]?2[0-5][0-9]{2})(?:[-\ ]?[0-9]{4}){2}|(?:352[89]|35[3-7][0-9]|358[0-9])(?:[-\ ]?[0-9]{4}){3}|1[0-9]{3}[-\ ]?[0-9]{5}[-\ ]?[0-9]{6}|5019(?:[-\ ]?[
@morajabi
morajabi / useRect.js
Created February 18, 2019 14:35
useRect — getBoundingClientRect() React Hook with resize handler
import { useLayoutEffect, useCallback, useState } from 'react'
export const useRect = (ref) => {
const [rect, setRect] = useState(getRect(ref ? ref.current : null))
const handleResize = useCallback(() => {
if (!ref.current) {
return
}