Skip to content

Instantly share code, notes, and snippets.

@lwcorp
lwcorp / pmfm.ai-multilink-adder-inline.js
Created June 5, 2025 20:18
Bookmarklet - Pmfm.ai app bot bulk link adder to knowledge base
@lwcorp
lwcorp / linkedin-group-sorting-inline.js
Last active June 5, 2025 20:15
Bookmarklet - LinkedIn Group sorting (both in search mode and when listing a user's groups) - including auto scrolling and optionally show just joined groups
javascript:(async function(){function p(t){t=t.replace(/,/g,"").trim();const a=t.split(/[\s\n]/)[0],m=a.match(/([\d.]+)([KkMm]?)/);if(!m)return 0;let n=parseFloat(m[1]),s=m[2].toLowerCase();return s==="k"?n*=1e3:s==="m"&&(n*=1e6),n}let c,cs,f,its,isC1=false;const c1=document.querySelector('[role="list"]>li');if(c1){c=c1.parentElement;its=Array.from(c.querySelectorAll(":scope > li"));cs="div:nth-of-type(2) > div > div:nth-of-type(2)";f=li=>!li.querySelector("button");isC1=true}else{const c2=document.querySelector(".active li.pvs-list__paged-list-item");if(!c2){alert("No groups found");return;}c=c2.parentElement;its=Array.from(c.querySelectorAll("li.pvs-list__paged-list-item"));cs=".pvs-entity__caption-wrapper";f=li=>{const b=li.querySelector("button");if(!b)return!1;const fl=b.textContent.trim().split("\n")[0].trim();return fl==="Joined"}}function hasPaging(){return!!document.querySelector(".artdeco-pagination__pages--number")}async function sD(){return new Promise(r=>{let l=document.documentElement.scrollHeig
@lwcorp
lwcorp / linkedin_dark_mode_minimize_messages_inline.js
Last active June 5, 2025 20:09
Bookmarklet - Force LinkedIn to respect system (e.g. Dark) mode, and to minimize message overlay
javascript:function settheme(){document.cookie="li_theme=system; path=/; domain=."+location.hostname+"; secure; SameSite=None",dynamic&&document.documentElement.classList.toggle("theme--dark")}function minimizemsg(){var e,t="voyager-web:msg-overlay-state",i="_listBubble",o=localStorage.getItem(t);!o||(o=(e=JSON.parse(o))[0])&&o[i]&&(o[i].isMinimized=!0,localStorage.setItem(t,JSON.stringify(e))),dynamic&&(e="#msg-overlay>div",0<(e=document.querySelectorAll(e)).length&&((e=e[0]).classList.contains("msg-overlay-list-bubble--is-minimized")||e.querySelector("header>div:last-of-type>button:last-of-type").click()))}function%20limitdomain(){"linkedin.com"==location.hostname.replace("www.","")&&(settheme(),minimizemsg(),dynamic||location.reload())}var%20dynamic=!1;limitdomain();
@lwcorp
lwcorp / cpanel_wsgi_template.py
Last active March 21, 2025 01:55
Run Python code via cPanel without restarting or timing out, and also use Flask
import os
import json
import html
import signal
from datetime import datetime
from flask import Flask, render_template, request, jsonify
# Check if `signal.alarm` is supported
signal_supported = hasattr(signal, 'SIGALRM')
if signal_supported:
@lwcorp
lwcorp / topic-api-classifier-inline.js
Last active June 5, 2025 20:08
Bookmarklet - Adds a download button to the Domain/App Category Classifier of chrome://topics-internals
javascript:adder();function adder(){var a="[slot=\"tab\"]:nth-of-type(2)";a=document.querySelectorAll(a),0<a.length&&(a=a[0],"false"==a.getAttribute("aria-selected")&&a.click(),addDownloadButton())}function addDownloadButton(){var a;if(a=document.querySelectorAll("#download"),0==a.length){let a=document.createElement("button");a.id="#download".replace(/[#\.]/,""),a.textContent="Download",a.href="#",a.onclick=function(){return downloader(),!1};let b=document.querySelector("#hosts-classification-button");b.parentNode.insertBefore(a,b.nextSibling)}}function downloader(){let a="#hosts-classification-result-table",b="td";if(b=a+" "+b,a=document.querySelectorAll(a),0<a.length&&0<document.querySelectorAll(b).length){let b=formatTableToCSV(a[0]),c=new Blob([b],{type:"text/csv;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(c),d.setAttribute("download","classification_results.csv"),document.body.appendChild(d),d.click(),document.body.removeChild(d)}}function formatTableToCSV(a){let b=[],c=a.
@lwcorp
lwcorp / cronner_auto.sh
Created March 25, 2024 14:08
Automatically add a command to cronjob to 1 minute later and remove once it starts (good for testing if a command runs well in a cronjob)
#!/bin/bash
# For example a Python command
user=type your user
folder=type your folder
command="source $HOME/.bashrc && source /home/$user/myenv/bin/activate && cd /home/$user/public_html/$folder && python index.py -run"
if [ "$1" = "-dummy" ]; then
command="$command $1"
elif [ "$2" = "-dummy" ]; then
@lwcorp
lwcorp / go_run.sh
Created March 25, 2024 14:07
Run a Go script portably and with parameters optionally in the background (allowing to keep working normally in Terminal)
#!/bin/bash
background=true
MAIN_PATH=/home/youruser/public_html/yourfolder
MAIN_FILE=your Go script WITHOUT extension
export TMPDIR=$MAIN_PATH/tmp/
cd $MAIN_PATH
if ! $background; then
go run $MAIN_FILE.go "$@"
@lwcorp
lwcorp / darkthemeswitcher-inline.js
Last active June 5, 2025 20:08 — forked from frontdevops/darkthemeswitcher-inline.js
Bookmarklet - Simple Dark Theme for web pages, but without affecting iframes (like embedded YouTube) and images that use background-image= instead of <img
javascript:(d=>{var css=`:root{background-color:#fefefe;filter:invert(100%)}*{background-color:inherit}iframe,[style*="background-image:"]:not([style$=".svg)"]),img:not([src*=".svg"]),video{filter:%20invert(100%)}`,style,id="dark-theme-snippet",ee=d.getElementById(id);if(null!=ee)ee.parentNode.removeChild(ee);else%20{style%20=%20d.createElement('style');style.type="text/css";style.id=id;if(style.styleSheet)style.styleSheet.cssText=css;else%20style.appendChild(d.createTextNode(css));(d.head||d.querySelector('head')).appendChild(style)}})(document)
@lwcorp
lwcorp / pastepad_he-inline.js
Last active October 16, 2020 09:56
Bookmarklet - Add Hebrew/RTL support FiveFilters.org's PastePad - when pushing to Kindle/creating files, make the text become right-to-left if it contains Hebrew
javascript:function add_heb_support_prepare(a){var b,c,d,e,f=document.querySelectorAll("input[type=\"submit\"]");for(e=0;e<f.length;e++)f[e].setAttribute("onclick","add_heb_support()");b=`
function add_heb_support() {
var prefix='<html lang="he" />', source_value = CKEDITOR.instances.body.getData(), source = '#cke_contents_body>textarea', source_btn = '#cke_34';
if (document.querySelectorAll(source).length==0)
document.querySelector(source_btn).click();
if(source_value.indexOf(prefix) == -1 && contains_heb(source_value))
CKEDITOR.instances.body.setData(prefix + source_value);
}
function contains_heb(str) {
return (/[\u0590-\u05FF]/).test(str);