Skip to content

Instantly share code, notes, and snippets.

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 : []
View TiledMenu3-AppsModel.qml
import QtQuick 2.0
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1
import QtQuick.Window 2.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.draganddrop 2.0 as DragAndDrop
import org.kde.plasma.private.kicker 0.1 as Kicker
View ComboBox3.qml
/*
* Copyright 2016 Marco Martin <mart@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
View _FetchRepos.py
import requests
import os
import json
os.makedirs('data', exist_ok=True)
# https://docs.gitlab.com/ee/api/projects.html
# https://docs.gitlab.com/ee/api/README.html#keyset-based-pagination
nextLink = 'https://invent.kde.org/api/v4/projects?pagination=keyset&per_page=50&order_by=id&sort=asc'
pageNum = 1
View nightcolor.py
import dbus
from enum import Enum
import argparse
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('temp',
type=int,
help='NightTemperature (eg: 4200)',
)
parser.add_argument('-d', '--delta',
View ResizeYT-ShortcutTest.user.js
// ==UserScript==
// @name Resize YT To Window Size
// @description Moves the YouTube video to the top of the website and fill the window with the video player.
// @author Chris H (Zren / Shade)
// @license MIT
// @icon https://s.ytimg.com/yts/img/favicon_32-vflOogEID.png
// @homepageURL https://github.com/Zren/ResizeYoutubePlayerToWindowSize/
// @namespace http://xshade.ca
// @version 125
// @include http*://*.youtube.com/*