Skip to content

Instantly share code, notes, and snippets.

View tondrej's full-sized avatar

Ondrej Kelle tondrej

View GitHub Profile
@tondrej
tondrej / update_keepass.sh
Last active March 15, 2024 19:39
Merge/sync local KeepassXC database with Dropbox
#!/bin/bash
DROPBOX_PATH=/Apps/Keepass2Android/main.kdbx
KDBX_DROPBOX=~/Documents/keepass/dropbox/main.kdbx
KDBX_LOCAL=~/Documents/keepass/main.kdbx
YUBIKEY_SERIALNO=9851170
YUBIKEY_SLOT=2
# 1. obtain dropbox API credentials from local keepassxc database
APP_KEY=$(keepassxc-cli show --yubikey $YUBIKEY_SLOT:$YUBIKEY_SERIALNO --no-password "$KDBX_LOCAL" Dropbox --attributes "API key")
@tondrej
tondrej / pre-commit
Last active October 7, 2022 11:46
Git pre-commit hook to normalize LMMS project files
#!/bin/sh
for f in $(git diff --cached --name-only); do
if [ "${f##*\.}" = "mmp" ]; then
lmms_normalizer "${f}" "${f}"
git add "${f}"
fi
done
@tondrej
tondrej / wmi-example.txt
Created October 30, 2020 13:44
chakracore-delphi WMI example output
***** InstancesOf('Win32_OperatingSystem') *****
BootDevice: \Device\HarddiskVolume1
BuildNumber: 19041
BuildType: Multiprocessor Free
Caption: Microsoft Windows 10 Pro
CodeSet: 1252
CountryCode: 1
CreationClassName: Win32_OperatingSystem
CSCreationClassName: Win32_ComputerSystem
CSDVersion: null
@tondrej
tondrej / wmi-example.js
Last active October 30, 2020 13:53
chakracore-delphi WMI example
// ask host to create an Automation object instance
let locator = createOleObject('WbemScripting.SWbemLocator');
const computerName = '.';
const namespace = '';
const userName = '';
const password = '';
// use it (access its properties and methods) from Javascript
let service = locator.ConnectServer(computerName, namespace, userName, password);
@tondrej
tondrej / test.dpr
Last active December 29, 2020 16:16
chakracore-delphi Variant example
// Calling javascript methods on variants creates temporary variant arrays for passing parameters.
// To avoid access violations after freeing the runtime, make sure all your code using Variants gets out of scope first.
procedure Test(Context: TChakraCoreContext);
var
Global, Json, MyObj: Variant;
begin
// assign javascript Global to a Variant
Global := JsValueToVariant(Context.Global);
@tondrej
tondrej / settings.json
Last active November 17, 2020 16:48
Windows Terminal Preview settings with git bash, WSL
// This file was initially generated by Windows Terminal Preview 1.1.1812.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
@tondrej
tondrej / Unit1.pas
Created July 1, 2020 16:55
IVCLComObject example
unit Unit1;
interface
uses
System.SysUtils, System.Classes;
type
TDataModule1 = class(TDataModule)
procedure DataModuleCreate(Sender: TObject);
@tondrej
tondrej / meld-2-files.nemo_action
Last active January 8, 2020 20:46
[Linux Mint] Nemo actions (~/.local/share/nemo/actions/)
# Compare two selected files in Meld
[Nemo Action]
#############################################
#### DEBUGGING:
####
#### Run Nemo with the environment
#### variable NEMO_ACTION_VERBOSE
#### set to get useful log output
@tondrej
tondrej / .bashrc
Last active June 26, 2019 18:46
git branch on bash prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;35m\]$(parse_git_branch)\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(parse_git_branch)\$ '
fi
@tondrej
tondrej / My Colors.xml
Last active June 23, 2019 11:22
Lazarus Editor Colors
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<Lazarus>
<ColorSchemes Version="12">
<Names Count="1">
<Item1 Value="My Colors"/>
</Names>
<Globals Version="12">
<SchemeMy_Colors>
<ahaGutter Background="clBtnFace"/>