Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env sh
root_path=$1
usage() {
echo "Usage: check_certificates.sh PATH"
echo ""
echo "Search for any certificate (*.pem, *.crt) in PATH then sort them by validity"
}
let page = 0;
const rxp = /bought (\d+|a) coffee/g;
const url = new URL("https://www.buymeacoffee.com/tGJba8O");
url.searchParams.set('notification', '1');
const gifts = [];
function addResult(text) {
gifts.push( ...[ ...text.matchAll(rxp) ].map(m => Number(m[1]) || 1) );
const nbCoffees = gifts.reduce((p, n) => p + n, 0);
const SEED = 16777215;
const FACTOR = 49979693;
function stringToColor(str) {
let b = 64;
let d = 192;
let f = 0;
if (str.length > 0) {
for (var i = 0; i < str.length; i++)
str[i].charCodeAt(0) > d && (d = str[i].charCodeAt(0)),
@el-gringo
el-gringo / shadertoy2glslsandox.frag
Last active May 19, 2020 11:59
Shadertoy compatibility for GLSLSandox
#ifdef GL_ES
precision mediump float;
#endif
// glslsandbox uniforms
uniform float time;
uniform vec2 resolution;
uniform vec2 mouse;
// shadertoy globals
@el-gringo
el-gringo / proxy-http.js
Last active February 28, 2018 12:38
Simple HTTP Proxy to bypass CORS protections. I used this for a REST API made with bottle.py
#!/usr/bin/env node
/*
node proxy-http.js [http_server_hostname] [http_server_port] [listening_port]
*/
const http = require('http');
const target = {
hostname: process.argv[2] || '127.0.0.1',
@el-gringo
el-gringo / sleep.js
Last active December 25, 2015 14:19
I use the multithread HTML5 worker which will be able to abort an synchronous XMLHttpRequest pointing to an unresponsive URL. This does not block the browser.
function sleep(milliseconds) {
var xhr = new XMLHttpRequest();
// Open a non existing url
xhr.open('GET', location.protocol + '//sleep' + (new Date()).getTime(), false);
var blob = new Blob([
"onmessage = function() { setTimeout(function() {postMessage('done');}, "+milliseconds+"); }"]);
var blobURL = window.URL.createObjectURL(blob);
var worker = new Worker(blobURL);
worker.onmessage = function() {
Processor Information:
Vendor: GenuineIntel
Speed: 2668 Mhz
8 logical processors
4 physical processors
HyperThreading: Supported
FCMOV: Supported
SSE2: Supported
SSE3: Supported
SSSE3: Supported