Skip to content

Instantly share code, notes, and snippets.

View leptoquark1's full-sized avatar

David leptoquark1

View GitHub Profile
@leptoquark1
leptoquark1 / bitwarden_find_duplicates.py
Last active March 28, 2026 03:26 — forked from gummipunkt/bitwarden_find_duplicates.py
Remove all Bitwarden duplicates from json file
import json
import os
from collections import defaultdict
import sys
def validate_json_structure(data):
"""Validate the basic structure of the Bitwarden JSON export"""
if not isinstance(data, dict):
raise ValueError("Invalid JSON format: Root must be an object")
if 'items' not in data:
@leptoquark1
leptoquark1 / impuls_sensor_from_digital_input_shelly_script.js
Last active January 11, 2025 02:08
A shelly script to publish the state of a (shelly addon or uni ) digital input that counts them as impuls signals
// Edit here =>
const CONFIG = {
InputId: 100,
Offset: 101189, // Initial count
Factor: 0.01, // total = count * factor
UnitOfMeasurement: 'm³',
MinimalImpulseDuration: 2000, // ms
UnpublishedCountThreshold: 2,
DefaultPublishInterval: 60000, // ms
MqttTopicNamespace: undefined, // Defaults to MqttConfig.topic_prefix or DeviceInfo.id
@leptoquark1
leptoquark1 / getLocalIpAddress.js
Last active May 4, 2024 17:19
NodeJS - Get relevant Local IP-Address to further determ subnet
function getLocalIpAddress() {
return Object.values(os.networkInterfaces())
.flat()
.filter(ifq => ifq.family === 'IPv4' && !ifq.internal && ifq.mac !== '00:00:00:00:00:00')
.map(ifq => ({ address: ifq.address, cidr: ifq.cidr }));
}
@leptoquark1
leptoquark1 / create_shell_patch_from_clipboard.sh
Created November 10, 2021 10:58
Create a "one-liner" Patch, executable in any shell without a patch file
#!/bin/zsh
patch=`pbpaste | base64`
echo "echo '$patch' | base64 -d | patch -p1" | pbcopy
echo "Clipboard converted"
@leptoquark1
leptoquark1 / ffmpeg_vid_conversion_commands
Created January 23, 2021 20:30
ffmpeg commands to convert videos fileformat with the goal to maintain the quality but to increase the compression of the source video
# .mov to .mp4 ^4k
ffmpeg -i videoName.mov -vcodec h264 -acodec mp3 videoName.mp4
# .mov to .webm
ffmpeg -i videoName.mov -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis videoName.webm
## TO BE CONTINUED
@leptoquark1
leptoquark1 / .zsh_startup.sh
Last active April 13, 2025 15:44
a_zsh_motivator.sh Terminal MOTD
#!/bin/zsh
## A SHELL MOTIVATOR (zsh)
## =======================
## Displays a random greeting and motivation.
##
## Assuredly to guarantee at least one of the following effects*
##
## It may:
## - cheer you up
## - boost your productivity