Skip to content

Instantly share code, notes, and snippets.

@nick-andren
nick-andren / mousefix.sh
Last active January 25, 2021 01:12
Disable mouse acceleration and adjust mouse speed in Linux (used on a Mint install)
#!/bin/bash
# Mouse Speed Fix by Nick Andren, January 2021
# How fast we want the pointer to move
mouseSpeed=8.0
# One of the problems that I've had with many Linux window managers is that they
# don't allow adjustments to *only* the mouse speed without mouse acceleration.
# This solution might not work for all types of mice, but in my case, it works
# with my Microsoft IntelliMouse. Even if you don't have one of these, this
@nick-andren
nick-andren / sqrt.sql
Created November 26, 2018 03:51
Using CTEs in SQLite to generate a square root. sqrt() isn't a native function within SQLite, so I wanted to see if I could recreate the process within a recursive CTE instead. Unfortunately, there doesn't seem to be a way to dynamically alter the initial values in a recursive CTE (at least not in a straightforward way), so this example will onl…
WITH RECURSIVE rsqrt AS (
SELECT 27 AS x,
1 AS step,
1 AS g
UNION ALL
SELECT x AS x,
step+1 AS step,
CASE WHEN g = ((x/g + g) /2.0) THEN x ELSE ((x/g + g) /2.0) END AS g