Skip to content

Instantly share code, notes, and snippets.

View solarkraft's full-sized avatar
🌟
Have a star!

Paul solarkraft

🌟
Have a star!
View GitHub Profile
@solarkraft
solarkraft / sh-L
Created February 23, 2023 14:04
Shell scripting is awesome
#!/usr/bin/env sh
addstuff=y; true && echo "a b$([ $addstuff = "y" ] && echo \" c\")"
# a b" c"
addstuff=y; stufftoadd=" c d"; true && echo a b$([ $addstuff = "y" ] && echo $stufftoadd)
# a bc d
@solarkraft
solarkraft / declutter-outlook.user.css
Last active January 13, 2023 20:09
Remove all the unnecessary junk from the Outlook Web App and polish it a little
/* ==UserStyle==
@name Declutter Outlook
@namespace https://github.com/solarkraft
@version 1.0.2
@description Remove all the unnecessary junk from the Outlook Web App and polish it a little
@author solarkraft
==/UserStyle== */
@-moz-document domain("outlook.office.com") {
#app > div > div:nth-child(2) {
[
// Quickly run tasks
{
"key": "cmd+r",
"command": "workbench.action.tasks.reRunTask"
},
{
"key": "shift+cmd+r",
"command": "workbench.action.tasks.runTask"
},
@solarkraft
solarkraft / syncthing-automerge.py
Created December 30, 2022 18:00
Monitors a Syncthing-synced directory and tries to merge conflicting files (based on https://www.rafa.ee/articles/resolve-syncthing-conflicts-using-three-way-merge/). Probably adaptable for other directory types, but only tested with Logseq (works for me™️).
import os
import time
import re
import subprocess
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
def get_relative_path(path):
return os.path.relpath(path)
@solarkraft
solarkraft / shut_up_mac.sh
Last active December 22, 2022 01:32
Continually delete meta-files Finder keeps creating on external drives
#!/usr/bin/env bash
path=$1
check() {
file=$1
echo "Checking $file"
# Anything matching /._*
if [[ $file =~ \/\._. ]] || [[ $file =~ \/\.DS_Store ]]; then
echo "Shut up $file"
@solarkraft
solarkraft / micropython-webrepl-cli.py
Last active December 20, 2022 06:40
(Simple) MicroPython WebREPL CLI to work around newline issues
#!/usr/bin/env python
import sys
import tty
import termios
import asyncio
import websockets
uri = "ws://192.168.2.69:8266"
password = ""
@solarkraft
solarkraft / tasks.json
Last active November 11, 2022 02:40
VSCode: Run current file/selected text
{
// You can bind "Rerun Last Task" to something convenient like cmd+R
"version": "2.0.0",
"tasks": [
{
"label": "Run current file",
"type": "shell",
"command": "echo Running from file: \"$(cat ${file})\"",
},
{
{
"useTabs": true,
"tabWidth": 4,
"semi": false,
"printWidth": 120
}
// ==UserScript==
// @name Tidal declutterer
// @namespace http://tampermonkey.net/
// @version 0.7
// @description Gives the Tidal web app some nice visual tweaks and hides non-personalized recommendations (ads). User configurable.
// @author solarkraft@mailbox.org
// @match https://listen.tidal.com/*
// ==/UserScript==
// The app is made with react and it would be preferable to directly hook into that to
@solarkraft
solarkraft / index.html
Last active April 28, 2022 23:47
Decoupling Logeq's published web app from its content
<!DOCTYPE html>
<head>
<meta charset="utf-8" />
<link href="static/css/style.css" rel="stylesheet" type="text/css" />
<!-- By far the least important -->
<!-- <link href="static/css/tabler-icons.min.css" rel="stylesheet" type="text/css" /> -->
<link href="custom.css" rel="stylesheet" type="text/css" />