Skip to content

Instantly share code, notes, and snippets.

@skamensky
skamensky / clean_ditto_db.py
Last active December 19, 2024 01:44
This script is intended to be used in conjunction with the Ditto clipboard manager (https://ditto-cp.sourceforge.io/). This script queries the ditto.db file for any images, writes the images to disk, and deletes the data from the ditto.db file.
import sqlite3
import os
from io import BytesIO
from PIL import Image
from pathlib import Path
import argparse
# Parse command-line arguments
parser = argparse.ArgumentParser(description='Process some data.')
parser.add_argument('--skip-backup', action='store_true', help='Do not write files to disk')
@thomasmaurer
thomasmaurer / settings.json
Last active August 16, 2025 10:14
My Windows Terminal Settings settings.json February 2021
// This file was initially generated by Windows Terminal 1.3.2651.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",
const xml2js = require('xml2js');
const fs = require('fs');
const xmlFileName = 'deployments.xml';
const environment = 'PROD';
const year = '2019';
xml2js.parseString(fs.readFileSync(xmlFileName), function (err, result) {
if (err) throw err;
@IanColdwater
IanColdwater / twittermute.txt
Last active October 25, 2025 19:14
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@coltenkrauter
coltenkrauter / fix-wsl2-dns-resolution.md
Last active October 29, 2025 11:37
Fix DNS resolution in WSL2

Permanent WSL DNS Fix (WSL 2.2.1+)

If you're encountering ping github.com failing inside WSL with a Temporary failure in name resolution, you're not alone — this has been a long-standing issue, especially when using VPNs or corporate networks.

This issue is now fixed robustly with DNS tunneling, which preserves dynamic DNS behavior and avoids limitations like WSL’s former hard cap of 3 DNS servers in /etc/resolv.conf.

DNS tunneling is enabled by default in WSL version 2.2.1 and later, meaning that if you're still seeing DNS resolution issues, the first and most effective fix is simply to upgrade WSL. Upgrading WSL updates the WSL platform itself, but does not affect your installed Linux distributions, apps, or files.

To upgrade WSL, follow these steps,

@stevenpdq
stevenpdq / Apply-SlackDarkTheme.ps1
Created June 11, 2019 16:24
Applies dark theme to Slack
# Find ssb-interop.js file thata needs to be patched
# Test-Path Machine-Wide 64-bit install
If (Test-Path "C:\Program Files\Slack\resources\app.asar.unpacked\src\static\ssb-interop.js") {
$ssbinteropPath = "C:\Program Files\Slack\resources\app.asar.unpacked\src\static\ssb-interop.js"
$exePath = "C:\Program Files\Slack\Slack.exe"
}
# Test-Path Machine-Wide 32-bit install
ElseIf (Test-Path "C:\Program Files (x86)\Slack\resources\app.asar.unpacked\src\static\ssb-interop.js") {
$ssbinteropPath = "C:\Program Files (x86)\Slack\resources\app.asar.unpacked\src\static\ssb-interop.js"
$exePath = "C:\Program Files (x86)\Slack\Slack.exe"
@FlogDonkey
FlogDonkey / Move TempDB.sql
Last active October 8, 2025 05:03
New and improved Move TempDB script. Captures xp_cmdshell value before execution and resets it post-execution. Allows for dynamic drive allocation in case of company policy of leaving some set percent of drive available for future growth. Also includes improved error handling and validation, as well as a @debug mode, allowing us to run the scrip…
/*
Snippet is nuts and bolts for creating/moving to an isolated tempdb drive.
After you run this, SQL Server must be restarted for it to take effect
*/
DECLARE @DriveSizeGB INT = 40
,@FileCount INT = 9
,@InstanceCount TINYINT = 1
,@VolumeBuffer DECIMAL(8, 2) = .8 /* Set to amount of volume TempDB can fill. */
,@RowID INT
,@FileSize VARCHAR(10)
@icasimpan
icasimpan / Ansible Let's Encrypt Nginx setup
Created December 27, 2018 21:19 — forked from mattiaslundberg/Ansible Let's Encrypt Nginx setup
Let's Encrypt Nginx setup with Ansible
Ansible playbook to setup HTTPS using Let's encrypt on nginx.
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS.
The server pass A rating on [SSL Labs](https://www.ssllabs.com/).
To use:
1. Install [Ansible](https://www.ansible.com/)
2. Setup an Ubuntu 16.04 server accessible over ssh
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder)
@soloradish
soloradish / vault_logrotate
Created September 12, 2018 02:25
logrotate setting file for HashiCorp's Vault audit file
# Change the path below to your own audit log path.
/var/log/vault/audit.log {
rotate 30
daily
# Do not execute rotate if the log file is empty.
notifempty
missingok
compress
# Set compress on next rotate cycl to prevent entry loss when performing compression.
delaycompress
@mkhamat
mkhamat / firefox-userjs-generator.js
Last active October 21, 2020 19:34
Firefox User.js Generator
/**
* This is script for https://gist.github.com/0XDE57/fbd302cef7693e62c769
* remove descriptions and leave only config lines!
* put it in txt file and pass path to it through arg
* example: node index.js ./config.txt
*
* user.js will appear in the same directory
*
*/