Skip to content

Instantly share code, notes, and snippets.

View LouDnl's full-sized avatar

LouD LouDnl

View GitHub Profile
@LouDnl
LouDnl / SIDERBAR.html
Created May 7, 2024 10:52
Sheets siderbar supporting html
<!DOCTYPE html>
<html>
<style>
.container,
.buttons {
margin: 5px;
width: 95%;
padding: 2px;
font-size: 13px;
}
@LouDnl
LouDnl / SERVER.gs
Created May 7, 2024 10:51
Sheets siderbar script
/**
* Changes the variable validation if needed
*/
var validation = {
sheet: 'Variabelen',
range: 'E2:E12'
}
// Simple trigger for the onInstall event
@LouDnl
LouDnl / dropdown.js
Last active May 7, 2024 10:26
Google Sheets Apps Script for multiple selections in a dropdown selector
// V4 ~ Still slow damnit
function onEdit(e) {
let triggeringSheets = new Array( // only in these sheets
"sheet1",
"sheet2",
"sheet3"
);
let triggeringColumns = new Array( // only in these columns
// BrondataFlevoland
15, // Column O == 15
@LouDnl
LouDnl / ignore_form.cljs
Created April 24, 2024 15:04
adapted version of ignore_form.cljs for Joyride
(defn get-position
[movement
& {:keys [steps] :or {steps 2}}]
(p/let [editor ^js vscode/window.activeTextEditor
_ (vscode/commands.executeCommand movement)
insert-position (.-active (eu/current-selection))
insert-position-2 (.with insert-position (.-line insert-position) (max 0 (- (.-character insert-position) steps)))
range-before-insert-position (.with (eu/current-selection) insert-position-2 insert-position)
text-before-insert-position (.getText (.-document editor) range-before-insert-position)
position-after (.with insert-position (.-line insert-position) (max 0 (+ (.-character insert-position) 1)))
@LouDnl
LouDnl / ups_lite_v13.py
Created August 30, 2023 11:55
Pwnagotchi UPS Lite v1.3 plugin
# Based on UPS Lite v1.1 from https://github.com/xenDE
#
# functions for get UPS status - needs enable "i2c" in raspi-config
#
# https://github.com/linshuqin329/UPS-Lite
#
# For Raspberry Pi Zero Ups Power Expansion Board with Integrated Serial Port S3U4
# https://www.ebay.de/itm/For-Raspberry-Pi-Zero-Ups-Power-Expansion-Board-with-Integrated-Serial-Port-S3U4/323873804310
# https://www.aliexpress.com/item/32888533624.html
#
@LouDnl
LouDnl / ip_geolocator.py
Created August 22, 2023 17:28
Python3 adaptation of maxmind_db_ip_geolocator.py https://pastebin.com/RTyBxDQs
#!/usr/bin/env python3
# Hello fellow hackers! My name is Defalt
# I built a very basic version of this tool a long time ago and recently did a re-write
# The first re-write had some awkward usage of the argparse module, so this update is going to fix it
# Original version: http://pastebin.com/J5NLnThL
# This will query the MaxMind database to get an approximate geolocation of an IP address
# Happy hacking! -Defalt
# 2023 Python3 with updated GeoIP database version by LouD
@LouDnl
LouDnl / ssstat.sh
Created August 19, 2023 08:42
Script for displaying listening and established connections using ss and their command lines using ps
#!/usr/bin/env bash
##
# Script for displaying listening and established connections using ss
# Prints information and complete command lines using ps in table form output
# NOTE: Can get messy output with long command lines
#
# LouD 2023-09-2023
## Example output:
@LouDnl
LouDnl / portforward.ps1
Created August 14, 2023 12:44
WSL Port Forwarding by John Wright - https://pastebin.com/HufmMFun
$ports = @(80, 443, 10000, 3000, 5000);
$wslAddress = bash.exe -c "ip addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'";
if ($wslAddress -match '^(\d{1,3}\.){3}\d{1,3}$') {
Write-Host "WSL IP address: $wslAddress" -ForegroundColor Green;
Write-Host "Ports: $ports" -ForegroundColor Green;
}
else {
Write-Host "Error: Could not find WSL IP address." -ForegroundColor Red;
@LouDnl
LouDnl / somestuff.clj
Created February 12, 2023 17:07
Clojure hiccup with inline scittle
[:div "SCITTLE JS"]
[:div#scittle-test
[:script {:type "application/x-scittle"}
(pr-str
'(defn my-alert []
(js/alert "You clicked! "))
;; export function to use from JavaScript:
'(set! (.-my_alert js/window) my-alert))]]
[:div
[:button.text-white.shadow.rounded.btn.bg-success.bg-gradient.border-info {:onclick "my_alert()"}
@LouDnl
LouDnl / google-apps-scripts.js
Last active November 29, 2022 15:30
Collection of Google Apps scripts
// Code for getting the values of cells by their fill color
/****************************************************************************************************
By LouD 2022-11-29 (adaption of countColoredCells())
Get cell value(s) based on the cell color in Google Sheets in the cell + rows where the formula is in
Use =returnColoredCelldata(RANGE; CELLID) or =returnColoredCelldata(RANGE, CELLID) depending on your region
where RANGE is the cell range to count and CELLID is the CELL to compare the colors with.
*****************************************************************************************************/
function returnColoredCelldata (cellRange, colorRef) {
var activeRange = SpreadsheetApp.getActiveRange();