Skip to content

Instantly share code, notes, and snippets.

@fredjoseph
fredjoseph / bookmarklets.md
Last active January 13, 2024 17:15
bookmarklets

Useful bookmarklets

A bookmarklet to remove sticky elements and restore scrolling to web pages!

javascript:(function()%7Bdocument.querySelectorAll(%22body%20*%22).forEach(function(node)%7Bif(%5B%22fixed%22%2C%22sticky%22%5D.includes(getComputedStyle(node).position))%7Bnode.parentNode.removeChild(node)%7D%7D)%3Bdocument.querySelectorAll(%22html%20*%22).forEach(function(node)%7Bvar%20s%3DgetComputedStyle(node)%3Bif(%22hidden%22%3D%3D%3Ds%5B%22overflow%22%5D)%7Bnode.style%5B%22overflow%22%5D%3D%22visible%22%7Dif(%22hidden%22%3D%3D%3Ds%5B%22overflow-x%22%5D)%7Bnode.style%5B%22overflow-x%22%5D%3D%22visible%22%7Dif(%22hidden%22%3D%3D%3Ds%5B%22overflow-y%22%5D)%7Bnode.style%5B%22overflow-y%22%5D%3D%22visible%22%7D%7D)%3Bvar%20htmlNode%3Ddocument.querySelector(%22html%22)%3BhtmlNode.style%5B%22overflow%22%5D%3D%22visible%22%3BhtmlNode.style%5B%22overflow-x%22%5D%3D%22visible%22%3BhtmlNode.style%5B%22overflow-y%22%5D%3D%22visible%22%7D)()%3B%0A

[ifr

@fredjoseph
fredjoseph / android.md
Last active August 5, 2023 14:46
Android

Cool applications

NetGuard (Github, Google Play)

  • description: NetGuard provides simple and advanced ways to block access to the internet - no root required. Applications and addresses can individually be allowed or denied access to your Wi-Fi and/or mobile connection.
  • description: A companion app that adds support for AirPod specific features to Android
  • description: Habo is a simple, open-source habit tracker for everyone
@fredjoseph
fredjoseph / Readme.md
Last active February 12, 2023 20:49
Continuous Integration & Deployment Tools (CI/CD)

Github Actions

Pros

  • Free for public repositories
  • 2000 minutes with 500 MB of storage for private repositories
  • Commits RSS Feed available publicly for private repositories (with a secret token passed as query param)
  • No credit card required

Cons

  • No Commits RSS Feed for private repositories
  • Connect to github
@fredjoseph
fredjoseph / get-cert.sh
Created November 17, 2022 13:21
Script for downloading a certificate
#!/bin/sh
#
# usage: retrieve-cert.sh remote.host.name [port]
#
REMHOST=$1
REMPORT=${2:-443}
echo |\
openssl s_client -connect ${REMHOST}:${REMPORT} 2>&1 |\
sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'

Download an artifact from Maven Central to local repository

mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:get -Dartifact=groupId:artifactId:version[:packaging[:classifier]]
@fredjoseph
fredjoseph / Profiler.ts
Created April 22, 2022 15:05
Angular Performance debugging
import { isDevMode } from '@angular/core'
/**
* Use to patch all functions/methods in a class and make them print out run time
* in ms to the console.
*
* This decorator will only patch functions declared in the target class.
* It will **not** patch functions reside in the **base class**.
* Dynamically created functions or functions received from the outside as input
* may also not be patched.

Some useful commands

Search for data created in the last X hours/minutes...

select * from <table> where created_at > now() - interval '2 days 2 hours 20 minutes'
@fredjoseph
fredjoseph / ImageMagick.md
Last active December 11, 2021 17:19
ImageMagick

ImageMagick

Various commands

Suppression du bruit sur la couleur de fond (ici blanche)

magick image.jpg -white-threshold 75%% -transparent white out.jpg

ℹ️ le double % est uniquement pour windows

@fredjoseph
fredjoseph / Readme.md
Created November 24, 2021 19:22
Json Server with faked data
  1. Crééer un projet npm à l'aide des fichiers package.json et index.js ci-joints
  2. Exécuter le projet pour générer un fichier Json contenant les données
node index.js > db.json
  1. Compiler l'image docker
docker build -t json-server .
  1. Lancer l'image docker
@fredjoseph
fredjoseph / Google.md
Created November 13, 2021 14:50
Google