Skip to content

Instantly share code, notes, and snippets.

@cherrysushi
cherrysushi / wayback_bookmarklet.js
Last active November 14, 2022 11:38
Bookmarklet to search current page on Google Cache and on the Wayback Machine (http://web.archive.org/), edited from https://gist.github.com/n-st/0dd03b2323e7f9acd98e. /!\ Allow pop-ups! Otherwise only Google Cache will open.
javascript: (() => { if (location.href) { origin = location.href; const url = ['https://webcache.googleusercontent.com/search?q=cache:' + origin, 'https://web.archive.org/web/*/' + origin + '*']; url.forEach(element => { window.open(element, "'" + element + "'"); }); } })();
@cherrysushi
cherrysushi / save_pdf_bookmarklet.js
Last active April 8, 2021 15:34
Bookmarklet to save pdf
javascript:document.getElementById('download').click();
@cherrysushi
cherrysushi / rmbr_pw_bookmarklet.js
Last active June 19, 2022 14:52
Bookmarklet to force browser to remember your password on current page
javascript: (() => { var%20ca,cea,cs,df,dfe,i,j,x,y;function%20n(i,what){return%20i+"%20"+what+((i==1)?"":"s")}ca=cea=cs=0;df=document.forms;for(i=0;i<df.length;++i){x=df[i];dfe=x.elements;if(x.onsubmit){x.onsubmit="";++cs;}if(x.attributes["autocomplete"]){x.attributes["autocomplete"].value="on";++ca;}for(j=0;j<dfe.length;++j){y=dfe[j];if(y.attributes["autocomplete"]){y.attributes["autocomplete"].value="on";++cea;}}}alert("Removed%20autocomplete=off%20from%20"+n(ca,"form")+"%20and%20from%20"+n(cea,"form%20element")+",%20and%20removed%20onsubmit%20from%20"+n(cs,"form")+".%20After%20you%20type%20your%20password%20and%20submit%20the%20form,%20the%20browser%20will%20offer%20to%20remember%20your%20password."); })()
@cherrysushi
cherrysushi / firefox.md
Last active November 14, 2022 11:48
Firefox optimization

Firefox about:config (can also be edited that way or even that way)

disable webp and avif advertisement

image.webp.enabled false image.avif.enabled false

open new tab next to current

browser.tabs.insertAfterCurrent true

open bookmarks in new tab

@cherrysushi
cherrysushi / ssh_screen.md
Last active April 23, 2021 06:12
SSH Screen

SSH & screen

automatically start screen upon ssh login

source

echo '
# tests whether you'\''re in a screen session and if not: runs screen -R
if [ -z "$STY" ]; then screen -R; fi
' >> .bashrc
@cherrysushi
cherrysushi / sudo_no_pw.md
Created April 23, 2021 06:19
sudo no password

sudo no password

Install sudo:

su root
apt-get install sudo
exit
@cherrysushi
cherrysushi / QRcode_bookmarklet.js
Last active June 19, 2022 14:45
Bookmarklet to create a QRcode of the current URL
javascript: (() => { qr_query=''+document.getSelection()||document.URL;window.location='https://chart.googleapis.com/chart?chs=540x540&cht=qr&chl='+encodeURIComponent(qr_query); })()
@cherrysushi
cherrysushi / README.md
Created November 13, 2021 11:26
Move Centreon to another network

How to move Centreon to another network

Context

My network address changed and I needed to still be able to supervise using Centreon. The address plan stayed the same from one network to the other and I didn't want to install a new Centreon from scratch & redo the setup of all the hosts and services. This is what I did to achieve the move from one network to the other.

Topology

The previous network will be referred to as previous network and the new one as new network. For the sake of this How-to, let's say that on the previous network the network address was 192.168.1.0 and the new network's address is 192.168.2.0.

I had one central Centreon-Central (or even central) and one Centreon-Poller (or poller). This is how I'll refer to these VMs here. We'll say that the central address ends with .2 on both the previous network and the new network, and the poller's ends with .3.

@cherrysushi
cherrysushi / GB-MB.py
Created June 19, 2022 14:29
Python script to batch convert GB to MB
#!python
import sys
# GB --> MB utility in Python3
# usage: GB-MB.py x [y]; GB-MB.py
'''
Windows:
Install python3
@cherrysushi
cherrysushi / howto.md
Created June 19, 2022 14:34
Connect to WSL2 from LAN

How to connect to WSL2 from LAN

1. On the WSL2 host machine

Open cmd as Administrator and paste/edit the following lines to taste (ie. edit Lport)

# chose the port to be used afterwards ie. replace 1234 by the port you want
set "Lport=1234"

# bind and listen to a specific port
netsh interface portproxy add v4tov4 listenport=%Lport% listenaddress=0.0.0.0 connectport=%Lport% connectaddress=localhost