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 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
View gist:d1e4381f809ec267ad4ef9b52d7248c6
// In: ~/.local/share/plasma/plasmoids/com.github.zren.tiledmenu/contents/ui/SearchView.qml
// https://github.com/Zren/plasma-applet-tiledmenu/blob/master/package/contents/ui/SearchView.qml#L237
SearchField {
id: searchField
visible: !config.isEditingTile && !!text
height: config.searchFieldHeight
anchors.left: parent.left
anchors.right: parent.right
listView: stackView.currentItem && stackView.currentItem.listView ? stackView.currentItem.listView : []