Skip to content

Instantly share code, notes, and snippets.

@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();
@LouDnl
LouDnl / gist:6ec447c1918ccaeb3a21
Created November 6, 2015 09:32
extDB Warnings
This file has been truncated, but you can view the full file.
extDB2: Version: 66
extDB2: https://github.com/Torndeco/extDB2
extDB2: Windows Debug Version
Message: All development for extDB2 is done on a Linux Dedicated Server
Message: If you would like to Donate to extDB2 Development
Message: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2SUEFTGABTAM2
Message: Also leave a message if there is any particular feature you would like to see added.
Message: Thanks for all the people that have donated.
Message: Torndeco: 20/02/15
@LouDnl
LouDnl / gist:8636774b0be91baaba3d
Created October 14, 2015 08:56
This cant be right
10:45:03 "[extDB2] Sleep [4]: 2670.41"
10:45:08 "WASTELAND SERVER - Money Mission waiting to run: mission_SunkenTreasure"
10:45:08 Performance warning: SimpleSerialization::Write 'messageSystem' is using type of ',TEXT' which is not optimized by simple serialization, falling back to generic serialization, use generic type or ask for optimizations for these types
10:45:08 Performance warning: SimpleSerialization::Read 'messageSystem' is using type of ,'TEXT' which is not optimized by simple serialization, falling back to generic serialization, use generic type or ask for optimizations for these types
10:45:10 "TERRITORY SYSTEM: _realLoopTime was 10.0171"
10:54:53 "onPlayerDisconnected - ["Basti","76561198018519179"]"
10:54:53 "onPlayerDisconnected - ["Artem23RUS","76561198203009930"]"
10:54:53 No player found for channel 980001600 - message ignored
10:54:53 No player found for channel 980001600 - message ignored
10:54:53 No player found for channel 980001600 - message ignored
{
"ADVERTS": [
"Want to know the available commands? Type <orange>/help<end>.",
"Respect the server <orange>/rules<end>.",
"This server is running <orange>Oxide 2<end>.",
"<red>Cheat is strictly prohibited.<end>",
"Type <orange>/map<end> for the server map link.",
"You are playing on: <lime>{server.hostname}<end>",
"<orange>Players Online: <lime>{players}<end> / <lime>{server.maxplayers}<end> Sleepers: <lime>{sleepers}<end><end>",
"The game time is <lime>{gametime}<end>",