Skip to content

Instantly share code, notes, and snippets.

View tgranqvist's full-sized avatar

Tom Granqvist tgranqvist

View GitHub Profile
# --------------------------------------------
# REQUIRED: DOCKER SPECIFIC SETTINGS
# --------------------------------------------
APP_VERSION=v8.0.4
APP_PORT=8000
# --------------------------------------------
# REQUIRED: BASIC APP SETTINGS
# --------------------------------------------
APP_ENV=production
@tgranqvist
tgranqvist / Validation patterns for XLSForm.md
Last active October 17, 2024 13:46
Validation patterns for XLSForm

Validation patterns for XLSForm

This is my collection of validation patterns for XLSForm, mainly used in Kobo. To use in Kobo, click the cog at the question, go to validation criteria, click to manually enter validation logic in XLSForm code and paste the pattern. Contributions welcome!

Phone number

regex(., '\+?\d+$')

Allows any length numeric, no-spaces phone number, possibly starting with "+" for country code.

@tgranqvist
tgranqvist / RouterOS dynamic DNS.md
Last active August 25, 2024 18:10
RouterOS dynamic DNS with Cloudflare API v 4

Dynamic DNS

This is a script I use for dynamic DNS from RouterOS, using the [Cloudflare DNS API][api]. Inspired by [bayukurnia.com][inspiration].

Preparations

  1. Get an [API token][token] from Cloudflare
  2. Get the identifier for your DNS zone, right sidebar
  3. Call the API to find out the record id
@tgranqvist
tgranqvist / README.md
Last active April 15, 2024 17:13
Extract Knexfile params from environment, use defaults if unset

Knexfile from environment

Run the below as follows

SQLite with default memory db

TEST_DB_TYPE=sqlite3 node index.js
<Configuration>
<VideoInput>Disable</VideoInput>
<ProtectedClient>Enable</ProtectedClient>
<PrinterRedirection>Disable</PrinterRedirection>
<ClipboardRedirection>Disable</ClipboardRedirection>
<MappedFolders>
<MappedFolder>
<HostFolder>C:\Users\TGrQ\.sandboxes\Scammer</HostFolder>
<SandboxFolder>C:\Tools</SandboxFolder>
<ReadOnly>true</ReadOnly>
@tgranqvist
tgranqvist / SendTo.md
Last active December 30, 2022 16:19
My SendTo setup for Windows 10

Custom SendTo setup

  • Single-file executables placed in a location on the path, e.g. %userprofile%.path.
  • Shortcuts created in Shell:SendTo
  • Shortcut targets set to the command below

Commands

VirusTotal

@tgranqvist
tgranqvist / README.md
Created October 9, 2022 19:03
Web Crypto API and OpenSSL

Web Crypto API and OpenSSL

This is a small demo using the [Web Crypto API] and [OpenSSL] to do file encryption with an RSA keypair.

Steps

  1. Generate the keypair
  2. Extract public key
  3. Create webpage
  4. Encrypt in browser
@tgranqvist
tgranqvist / Requirements.txt
Created August 21, 2020 15:17
A quick test to scrape product info from verkkokauppa.com page, with Python+Selenium+ChromeDriver
beautifulsoup4==4.9.1
certifi==2020.6.20
chardet==3.0.4
idna==2.10
lxml==4.5.2
selenium==3.141.0
soupsieve==2.0.1
urllib3==1.25.10
@tgranqvist
tgranqvist / KoboClient.cs
Last active February 3, 2020 21:29
A very basic API client for KoboToolbox API
using System;
using System.Text.RegularExpressions;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Collections.Generic;
namespace APITest
{
public class KoboClient
@tgranqvist
tgranqvist / .env
Last active August 25, 2019 21:37
Azure Form Recognize
FORMS_API_URL = _your api endpoint_
FORMS_API_KEY = _your api key_
FORMS_MODEL_ID = _your model id_