Skip to content

Instantly share code, notes, and snippets.

@optinsoft
optinsoft / docker-compose.yml
Created July 20, 2026 06:01
Launch Firefox in Docker
services:
firefox:
image: jlesage/firefox
container_name: firefox
ports:
- "3000:3000"
- "5900:5900"
volumes:
- ./config:/config
restart: unless-stopped
@optinsoft
optinsoft / gist:58bb2851ff7237e2c0edc146087e9391
Created July 20, 2026 05:32
Force the .NET Garbage Collector to immediately reclaim all possible memory
GC.Collect(2, GCCollectionMode.Forced, blocking: true, compacting: true);
GC.WaitForPendingFinalizers();
@optinsoft
optinsoft / golang-install-on-debian.md
Created March 25, 2026 13:59 — forked from zoonderkins/golang-install-on-debian.md
Install Golang on Debian / Raspberry Pi #linux

Last update at 2026-03-06

Install Golang on Debian / Raspberry Pi

rm -rf /usr/local/go
GOVERSION="1.26.1"
wget "https://golang.org/dl/go${GOVERSION}.linux-amd64.tar.gz" -4
@optinsoft
optinsoft / formatdate.js
Last active December 13, 2025 11:18
Formats a JavaScript Date into a local timestamp string: YYYY-MM-DDTHH:MM:SS.mmm.
/**
* Formats a Date object into a string of the form:
* YYYY-MM-DDTHH:MM:SS.mmm
*
* All numeric components are zero-padded to ensure fixed width.
* The result reflects the local time of the supplied Date object
* and does not include any timezone suffix.
*
* @param {Date} dt - The Date object to format.
* @returns {string} The formatted timestamp string.
@optinsoft
optinsoft / gist:3160f8f81e9d610a0fe000b3c13be38f
Created June 26, 2025 15:30
replace placeholders enclosed in curly braces, like {thread}, {thread%10}, {thread/10}, with values
class NumReplacer(dict):
def __init__(self, **kwargs):
dict.__init__(self, **kwargs)
def __missing__(self, key):
karr = key.split('%')
if (len(karr) == 2) and karr[1].isdigit():
value = dict.get(self, karr[0], None)
if not value is None:
mod = int(karr[1])
return str(value % mod)
@optinsoft
optinsoft / gist:02b9dcce3afe6419e72cae9ed9fc975d
Last active June 11, 2025 15:55
Convert javascript class to object
async function classToObject(clss) {
var clss_list = []
var promises = []
function c2o(clss) {
const isObject = v => typeof v === "object" && v !== null
const isFunction = v => typeof v === "function"
const isRecursion = v => clss_list.find(item => item.clss === v)
const keys = x => Object.getOwnPropertyNames(x).concat(Object.getOwnPropertyNames(x?.__proto__||{})).filter(k => k !== 'enabledPlugin')
var object = {}
clss_list.push({clss, object})
@optinsoft
optinsoft / gist:f7665b0593eea392fca355ef3561c0db
Created March 13, 2025 12:34
Extract visited domains from chrome history
/* Chrome History Sqlite Db: C:\Users\YOUR_USER_NAME\AppData\Local\Google\Chrome\User Data\Default\History */
select distinct substr(substr(' '||top_level_url,instr(' '||top_level_url, '//')+2),1,instr(substr(' '||top_level_url,instr(' '||top_level_url, '//')+2)||'/','/')-1) as domain
from visited_links
@optinsoft
optinsoft / gist:b80edef76ab87fde778922960cfacbb7
Created January 29, 2025 16:27
Install Windows Terminal on Windows 2022
Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile Microsoft.VCLibs.x86.14.00.Desktop.appx
Invoke-WebRequest -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.5/Microsoft.UI.Xaml.2.8.x64.appx -OutFile Microsoft.UI.Xaml.2.8.x64.appx
Invoke-WebRequest -Uri https://github.com/microsoft/terminal/releases/download/v1.19.11213.0/Microsoft.WindowsTerminal_1.19.11213.0_8wekyb3d8bbwe.msixbundle -OutFile Microsoft.WindowsTerminal_1.19.11213.0_8wekyb3d8bbwe.msixbundle
Add-AppxPackage Microsoft.VCLibs.x86.14.00.Desktop.appx
Add-AppxPackage .\Microsoft.UI.Xaml.2.8.x64.appx
Add-AppxPackage .\Microsoft.WindowsTerminal_1.19.11213.0_8wekyb3d8bbwe.msixbundle