Skip to content

Instantly share code, notes, and snippets.

View splitqtd.py
#!/bin/python3
import os
import os.path
import re
import argparse
def formatSplitFilepath(filepath, splitIndex):
splitQtdFormat = filepath.replace('.qtd', '-{}{}.qtd')
assert splitIndex <= 26*26
a1 = chr(ord('a') + (splitIndex // 26))
View git-lsdir.sh
#!/bin/bash
# To run anywhere with "git lsdir"
# sudo mv ./git-lsdir.sh /usr/local/bin/git-lsdir
# sudo chmod +x /usr/local/bin/git-lsdir
Red='\033[0;31m'
Orange='\033[0;33m'
LightRed='\033[91m'
LightGreen='\033[92m'
Yellow='\033[93m'
View HackerNews-DarkMode.css
@-moz-document domain("hckrnews.com") {
html, body {
color: #c1c2c3; /* #333333 */
background-color: #111213; /* #ffffff */
}
a {
color: #aaaaaa; /* #333333 */
}
a:hover {
View osc_tethys.lua
local assdraw = require 'mp.assdraw'
local msg = require 'mp.msg'
local opt = require 'mp.options'
local utils = require 'mp.utils'
print("get_script_name: ".. mp.get_script_name())
--
-- Parameters
--
View opensuse_postinstall.sh
#!/usr/bin/sh
# https://gist.github.com/Zren/d39728991f854c0a5a6a7f7b70d4444a
# Updated: 2022-01-24
### Media Codecs (MP4 / Netflix DRM)
# https://en.opensuse.org/Additional_package_repositories
sudo zypper ar -cfp 90 https://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Tumbleweed/Essentials packman-essentials
sudo zypper dup --from packman-essentials --allow-vendor-change
### Zren's Apps
View QuickTileAppOnStart.js
function onClientAdded(client) {
if (client.resourceName == "navigator" && client.resourceClass == "firefox") {
client.activeChanged.connect(function quickTileClientOnFocus(){
workspace.slotWindowQuickTileLeft()
client.activeChanged.disconnect(quickTileClientOnFocus)
})
}
}
workspace.clientAdded.connect(onClientAdded)
View KdeBlurTest.py
import sys
from PyQt5 import QtCore, QtGui, QtWidgets, Qt
from Xlib import X, Xatom
from Xlib.display import Display
from Xlib.error import CatchError, BadAtom
def enable_blur(widget: QtWidgets.QWidget):
ec = CatchError(BadAtom)
display = Display()
print('ec', ec)
View PAVolumeSteps.sh
function pa_defaultsink_name () { pacmd stat | awk -F": " '/^Default sink name: /{print $2}'; };
function pa_defaultsink_getvolume () { pacmd list-sinks | grep -A10 "$(pa_defaultsink_name)" | grep "volume: front-left:" | sed 's/\tvolume: front-left: // ; s/,\s*front-right:.*//'; };
function pa_defaultsink_setvolume () { pactl set-sink-volume "$(pa_defaultsink_name)" "$1"; pa_defaultsink_getvolume; };
for i in $(seq 0 150); do pa_defaultsink_setvolume "${i}%"; sleep 1; done > ~/Desktop/PAVolumeSteps.txt
View RedditUserHistory.py
import os
import datetime
import praw
reddit = praw.Reddit(
client_id='...',
client_secret='...',
user_agent='RedditUserHistory.py',
username='...',
password='...'
View pacman_apt.py
#!/bin/python3
# To install:
# EDITOR=nano sudoedit /usr/local/bin/apt
# Paste script with (Ctrl+Shift+V), then run following to make it executable:
# sudo chmod +x /usr/local/bin/apt
import os, sys
import re
import argparse