Skip to content

Instantly share code, notes, and snippets.

View marcus-at-localhost's full-sized avatar
💭

Marcus marcus-at-localhost

💭
View GitHub Profile
@marcus-at-localhost
marcus-at-localhost / flipbook2pdf.js
Created July 25, 2026 13:26
open dev tools on a flipbookhtml5 thingie and paste this code into the console! Don't do it if you don't know what the code is doing! It's a security ris to copy and paste code from the internet in your browser! this is relying on `fliphtml5_pages` global variable to count the pages and this gets around CSP isuues (3rd party pdf.js script is not…
// Script d'extraction BookPreview/FlipPDFPlusPro vers PDF
// À exécuter dans la console du navigateur
// Builds PDF from JPEG bytes locally — no external libs, no CSP issues.
// based on https://github.com/arthur-mdn/ExtractJSFlipPDFPlusProToPDF/blob/main/script.js
const debug = false;
(async function () {
console.log('Starting extraction...');
@marcus-at-localhost
marcus-at-localhost / forminator-submission-date-format.php
Last active August 25, 2025 07:50 — forked from wpmudev-sls/forminator-submission-date-format.php
[Forminator] - Custom form submission date format
<?php
/**
* Plugin Name: [Forminator] - Custom form submission date format (Rev.1.1)
* Description: This MU Plugin allows the usage of a custom date format for the Submission page
* Author: Anderson Salas @ WPMUDEV
* Task: SLS-3998
* Author URI: https://premium.wpmudev.org
* License: GPLv2 or later
*/
Updated list / Nov 17 - 2024
Posting - https://posting.sh/ - Terminal Based
ATAC - https://github.com/Julien-cpsn/ATAC
Rest.nvim - https://github.com/rest-nvim/rest.nvim
Slumber - (uses tui client) https://slumber.lucaspickering.me/
@marcus-at-localhost
marcus-at-localhost / search.md
Last active November 19, 2024 16:10
Search current site with google bookmarklet
javascript:(function(){var query=prompt('Enter search query:');if(query){var site=window.location.hostname;window.location.href='https://www.google.com/search?q=site:'+site+'+'+encodeURIComponent(query);}})();
@marcus-at-localhost
marcus-at-localhost / inject-script.js
Created May 27, 2024 21:28 — forked from umayr/inject-script.js
How to inject the script in the body of the document and wait till it has been loaded completely
// injects the script in the body of the document.
// returns a promise that gets resolves once the script has been loaded in the document
export const injectScript = (url, document = window.document) => {
const script = document.createElement('script');
script.src = url;
script.type = 'text/javascript';
script.async = true;
const body = document.getElementsByTagName('body')?.[0] ?? null;
if (body === null) {
@marcus-at-localhost
marcus-at-localhost / recover-deleted-branch.sh
Created May 27, 2024 21:26 — forked from umayr/recover-deleted-branch.sh
How to recover a deleted branch
## Pre-requisite: You have to know your last commit message from your deleted branch.
git reflog
# Search for message in the list
# a901eda HEAD@{18}: commit: <last commit message>
# Now you have two options, either checkout revision or HEAD
git checkout a901eda
# Or
git checkout HEAD@{18}
@marcus-at-localhost
marcus-at-localhost / List all Hard Links and Junctions.md
Created January 7, 2024 08:56
List all Hard Links and Junctions.md
@marcus-at-localhost
marcus-at-localhost / Simple template string replacement with strstr.md
Created August 17, 2023 17:58
Simple template string replacement with strstr.md

...instead of sprintf or str_replace[^1] in #php #string #template #pitfall

$strTemplate = "My name is :name, not :name2.";
$strParams = [
  ':name' => 'Dave',
  'Dave' => ':name2 or :password', // a wrench in the otherwise sensible input
  ':name2' => 'Steve',
 ':pass' =&gt; '7hf2348', // sensitive data that maybe shouldn't be here
@marcus-at-localhost
marcus-at-localhost / How to create a nested data-transfer-object (DTO) array with different types.md
Created July 29, 2023 07:57
How to create a nested data-transfer-object (DTO) array with different types.md
@marcus-at-localhost
marcus-at-localhost / Results of POST Request in Browser Window via Browser Console.md
Created July 29, 2023 07:48
Results of POST Request in Browser Window via Browser Console.md

#js

  1. Open network tab in #dev-tools
  2. Right click on request and copy as fetch
  3. Add the .then() part to the fetch() and send the request
  4. Result will be inserted in browser main window
fetch("https://teeeeeessssstttttt.com/ticket/", {