Skip to content

Instantly share code, notes, and snippets.

View Iksas's full-sized avatar

Iksas

View GitHub Profile
@Iksas
Iksas / offscreen-fix.md
Created February 7, 2025 11:50
Recover off-screen windows

Recover off-screen windows

Sometimes, in Windows 10/11, an application's window can get "stuck" off-screen, and cannot be moved.

The following steps can be used force the window to move to the currently used screen:

  • Activate the window in the task bar
  • Press Alt + Space to open the window's menu
  • Press M
  • Press Enter
@Iksas
Iksas / pdf_index.md
Last active November 7, 2024 14:27
Full-text search for PDFs

Fast PDF full-text search

The following setup can search the contents of 7000 .pdf files in 0.08 seconds on an i7-1260P (less than 12 microseconds per PDF).

To do so, each .pdf file is first converted to a .txt file, which is stored next to the .pdf. If necessary, OCR is performed. This process takes hours.

As soon as all .txt files are created, they can be quickly searched with ripgrep.

The solution is a bit hacky, but it's what I use at the moment. I'll probably benchmark it against ripgrep-all in the future, and maybe switch to that.

@Iksas
Iksas / wg-multi-tunnel.md
Last active November 17, 2024 20:38
Auto-connecting multiple Wireguard tunnels in Windows

Wireguard multi-tunnel auto-connect in Windows

Set up multiple simultaneous Wireguard tunnels that auto-connect on boot in Windows.

Install the Wireguard tunnels

Install the Windows version of Wireguard and import the two tunnel .conf files.

Set required registry key

@Iksas
Iksas / systemd_sandboxing.md
Created August 8, 2024 20:11
systemd sandboxing

Fixing systemd sandboxing errors

Crash with status=31/SYS

user@ansible-test:~ $ journalctl -u mongod.service | tail
[...]
Aug 08 17:29:42 ansible-test systemd[1]: Started mongod.service - MongoDB Database Server.
Aug 08 17:29:43 ansible-test systemd[1]: mongod.service: Main process exited, code=killed, status=31/SYS
Aug 08 17:29:43 ansible-test systemd[1]: mongod.service: Failed with result 'signal'.
@Iksas
Iksas / wg-quick-fix.md
Last active March 28, 2025 00:40
wg-quick fix on macOS

Fixing wg-quick on macOS

On some macOS setups, wg-quick up does not work correctly if the Wireguard configuration includes a DNS server address.

When this error occurs, wg-quick up exits with the following lines, and the Wireguard tunnel will not work:

$ sudo wg-quick up wg0
...
[#] rm -f /var/run/wireguard/utun3.sock
[#] rm -f /var/run/wireguard/wg0.name
@Iksas
Iksas / git.md
Last active December 27, 2023 12:41
git cheat sheet

git cheat sheet

  • Search the reflog for info about a commit (only works if the relevant info hasn't been garbage-collected):

git reflog --no-abbrev | grep <HASH>

  • List the number of lines in each file:

git ls-files | xargs wc -l

@Iksas
Iksas / firefox-profile.md
Last active June 8, 2023 15:23
Firefox user.js

My Firefox user.js

Type about:profiles into the URL bar to display the profile folder path.

Copy the user.js file to the default profile's root folder.

After restarting Firefox, about:config can be used to check if the settings have been applied correctly.

@Iksas
Iksas / argparse.py
Created March 21, 2023 07:13
argparse template
import argparse
...
if __name__ == "__main__":
# parse CLI arguments
parser = argparse.ArgumentParser(description="Search popular Hacker News posts")
parser.add_argument('-u', '--update', default=False, help='update the database', action='store_true', dest='update')
parser.add_argument('-d', '--domain', default=False, help='search for posts from a domain', action='store_true', dest='domain')
parser.add_argument('query', nargs='?', help='the search query')
@Iksas
Iksas / .moodle4.md
Last active March 17, 2023 19:08
Reduce white space in Moodle 4.0

Moodle 4.0 custom CSS

The following CSS can be used make the layout of Moodle 4.0 more compact.

Use it with a browser extension that permits the application of user-defined CSS, for example Stylus (on Firefox or Chrome).

@Iksas
Iksas / blocklists.md
Last active April 11, 2024 10:17
Pi-hole blocklists

Pi-hole blocklists

The following file contains blocklists I use with my Pi-hole installations.

It blocks with minimal false positives:

  • ads / spam / telemetry / tracking
  • malware
  • phishing and fraudulent websites
  • torrents