Skip to content

Instantly share code, notes, and snippets.

View Manvan33's full-sized avatar

Manvan Manvan33

View GitHub Profile
@Manvan33
Manvan33 / binary_game_solver.js
Created August 14, 2023 11:50
JavaScript code to create a "solve" button on Cisco's binary game: https://learningcontent.cisco.com/games/binary/index.html
const grid = document.querySelector(".problem-container");
function solve1() {
let problems = grid.querySelectorAll(".problem-wrapper");
problems.forEach(p => {
let digits = p.querySelector(".digits");
if (digits.classList.contains("isProblem")) {
let binary = p.querySelector(".bits").textContent;
let decimal_string = binaryToDecimal(binary).toString();
// console.log("decimal_string: " + decimal_string);
@Manvan33
Manvan33 / fizzbuzz.js
Created October 3, 2022 17:07
// The (best) way to code fizzbuzz in Javascript :D
for(let i=0; i<100; i++) {
console.log((i%3==0 && "Fizz" || "") + (i%5==0 && "Buzz" || "") + (( (i%5 != 0 && i%3 !=0) && ""+i) || ""));
}
@Manvan33
Manvan33 / pve_bulk_wipe.sh
Created June 11, 2022 16:59
Allows you to wipe disks in bulk in proxmox
#!/bin/bash
# You need a CSRF Token, an Authorization Cookie and your Proxmox URL
#
# By default, it WIPES ALL DISKS from a to z, you'll probably need to change that, and exclude at least your boot disks :)
PROXMOX_FQDN=""
AUTH_COOKIE=""
CSRF=""
for disk_letter in {a..z}
@Manvan33
Manvan33 / reduce.py
Created May 17, 2022 11:48
reduce CSS from chrome coverage report
#!/bin/python3
# source: https://moonbooks.org/Articles/How-to-remove-unused-css-using-google-chrome-and-python-/
from fileinput import filename
import json
with open('Coverage.json') as json_data:
raw_code_coverage_list = json.load(json_data)
file_name = 'bootstrap_full.css'
@Manvan33
Manvan33 / gitdeploy.sh
Last active October 10, 2024 09:47
gitdeploy.sh - to use multiple deploy keys on the same host
#!/bin/bash
# Script that creates unique deploy keys for each local git repo that you push or clone
# It allows usage of multiple deploy keys on the same machine.
# Usage: gitdeploy.sh clone/push/add <remote-ssh-url>
# Arguments
if [[ -z $1 || -z $2 ]]
then
echo "Missing argument. Usage: gitdeploy.sh clone/push/add <remote-ssh-url>"
exit 1
#!/bin/bash
# Usage : ffcert.sh <certfile.pem>
# Opens certificate chain from given file in firefox certificate inspector gui.
firefox "about:certificate?cert=\
`cat $1 | grep -v CERTIFICATE | tr -d "\n" | sed -e "s/\//%2F/g" -e "s/+/%2B/g" -e "s/=/%3D/g"`"
@Manvan33
Manvan33 / wifirst_reconnect.sh
Last active March 24, 2022 09:58
Reconnect to wifirst's captive portal using wget (openwrt-compatible method)
# Command that updates your session on Wifirst's captive portal
# replace <id> with your user ID, and <hash> with your password hash.
# Both can be found in the network inspection tab of your browser when connecting manually to the portal.
#
# You may also want to change the ip 10.189.0.1 to your gateway ip address (found with `ip route | grep default`)
#
wget --post-data="username=GUEST/end_user_<id>@wifirst.net&password=<hash>&success_url=http://127.0.0.1/&error_url=http://127.0.0.1/&update_session=0"\
https://10.189.0.1:8090/goform/HtmlLoginRequest --no-check-certificate