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
unit Data.Win.OleDbUtils;
interface
uses
System.Classes,
System.SysUtils,
System.Win.ComObj,
Winapi.Windows,
Winapi.ActiveX,
@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 / 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 / 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 / ADORecordSet.pas
Last active July 12, 2020 10:56
A very crude ADO RecordSet wrapper for a TDataSet with basic navigation
unit ADORecordSet;
interface
uses
Winapi.Windows, Winapi.ActiveX, Winapi.ADOInt,
System.Classes, System.SysUtils, System.Win.ComObj, System.Variants,
Data.DB;
type
@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 / lazarus-external-tools-linux-mint.xml
Created October 20, 2018 09:32
Lazarus External Tools
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG Version="3" Count="4">
<Tool1>
<Title Value="Explore to Source Directory"/>
<Filename Value="caja"/>
<CmdLineParams Value="$Path($EdFile())"/>
<HideWindow Value="False"/>
</Tool1>
<Tool2>
<Title Value="Explore to Target Directory"/>