Skip to content

Instantly share code, notes, and snippets.

View olmokramer's full-sized avatar
💭
#codegradelife

Olmo Kramer olmokramer

💭
#codegradelife
View GitHub Profile
@olmokramer
olmokramer / css-color-regex
Last active December 9, 2023 12:52
Regex for CSS colors: hex, rgb(a), hsl(a)
/(#([0-9a-f]{3}){1,2}|(rgba|hsla)\(\d{1,3}%?(,\s?\d{1,3}%?){2},\s?(1|0?\.\d+)\)|(rgb|hsl)\(\d{1,3}%?(,\s?\d{1,3}%?\)){2})/i
// background transparency
background-transparency(color, alpha = 1)
ms-color = argb(color, alpha)
background rgb(color)
background rgba(color, alpha)
.lt-ie8 &
zoom 1
.lt-ie9 &
background transparent
filter s('progid:DXImageTransform.Microsoft.gradient(startColorstr=%s,endColorstr=%s)', ms-color, ms-color)
@olmokramer
olmokramer / video-controls.user.js
Last active July 3, 2018 12:12
Video controls for qutebrowser
// ==UserScript==
// @name VideoControls
// @namespace https://github.com/olmokramer
// @description Add mouse and keyboard controls to video elements
// @include *
// @version 8
// @author Olmo Kramer
// ==/UserScript==
// Controls:
@olmokramer
olmokramer / url-rewriter.user.js
Last active September 19, 2018 19:47
Rewrite/redirect URLs
// ==UserScript==
// @name url-rewriter
// @namespace https://github.com/olmokramer
// @description Rewrite current url or urls on the page
// @match *://*/*
// @run-at document-start
// @version 2
// @author Olmo Kramer
// ==/UserScript==
@olmokramer
olmokramer / github-autosort-updated.user.js
Last active April 13, 2018 10:24
Sort issues/prs by most recently updated on GitHub
// ==UserScript==
// @name autosort-updated
// @namespace https://github.com/olmokramer
// @description Automatically sort by updated-desc
// @include *://github.com/*
// @version 2
// @author Olmo Kramer
// ==/UserScript==
(function() {
@olmokramer
olmokramer / config
Last active August 8, 2023 18:18
Herbstluftwm workspaces for polybar
[module/herbstluftwm]
type = custom/script
exec-if = ps -C herbstluftwm >/dev/null 2>&1
exec = MONITOR=HDMI-0 ~/.config/polybar/herbstluftwm.sh
tail = true
@olmokramer
olmokramer / config.py
Created September 6, 2018 22:53
Qutebrowser per-domain stylesheets
c.content.user_stylesheets = ['/path/to/reddit.user.css']
# or if you have a directory with .user.css files:
import glob
c.content.user_stylesheets = glob.glob('/path/to/*.user.css')
@olmokramer
olmokramer / nyan-scrollbar-horizontal.user.css
Last active December 13, 2020 19:25
Nyancat scrollbars in chromium
:root {
--background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABXQAAAETCAIAAAAZKRlkAAAJXXpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjarZhpkuS4DUb/6xQ+gkAQXI5DcInwDXx8P0jZ1VPdMxO2w5ldmSqVRJH4NrCv/a9/nusfvJK2dmWrrfRSbl65554GB+1+X++33Pn5fF413/Y5++38Jfo5THwr3/r+oez3Wwbn7dtA73n/fv6q8z1I7TPQ5w8M/Lw0nhzHn+vaZyBN73n5/H71z30j/2E5n580P8N+Bv/191wpxjLG03SlrayOzxJPUWagTQff/flsKc5kjpPae+bPa3d9Hf5SPE1fS/xWu3t8rtDvpbju8rmg/FKjz3mxX87/GDAq9A21+wu1b3/Q/UWC32p3zmrn7Hd1IxcqVa7Pon6U8DniQqeU+txWeFd+jOP6vDvvxhIniC3QdN7zki6Jah/JsmTIkf18T5lMMaedKt8pzaTPuaY19TT1hYC3nFQBZl1glHSCmnI6fc1Fnuf253lTGk9ewpVJGEy447f39Wcn/5f310DnBHVFopgPax+AU5CAaQRy8clVACLnU1N76vu8ry9Yf74CWL1DnFHmxgLH7e8QbvKTW/rgrFxnd77uVxpS12cASsSzjcmIgsBdRE2K3DWlKkIdG/gMZp40JwcBMUtLrgM2qgVwUAPP5p4qz7XJ0nsaawEI06IVaJAOYOVs8KfmBoeGqeXLzIpVa9ZtFC25WCmllvCoUbXmarXUWlvtdTRtuVkrrbbWehs9dcXCrJder95672Pw0MHQg7sHV4zhydWzmxev3rz7mNBn5mmzzDrb7HOstHQh/1VWvVZbfY0tGyrtvG2XXXfbfY8D146efOyUU087/Ywv1D6ofkdNfkHu71GTD2qBWH6uqz9R43StP4aQsBMLzEAsZQHxGghA6BSY3U1yToFcYHb3hCgsgZpYgLMkEAPBvCXZkS/
@olmokramer
olmokramer / config.py
Last active November 4, 2018 23:42
Qutebrowser hints for reddit expando buttons
config.set('hints.selectors': {
'all': [*c.hints.selectors['all'], '.expando-button'],
}, pattern='*://*.reddit.com/*')
# You can also add a custom hint group that only selects the expand buttons.
config.set('hints.selectors', {
'reddit-expand': ['.expando-button'],
}, pattern='*://*.reddit.com/*')
# Add binding for the new hint group.
@olmokramer
olmokramer / checkbox.vim
Last active April 30, 2021 22:19
Markdown checkbox toggle mappings for Vim
" ~/.vim/autoload/markdown/checkbox.vim
let s:bullet = '^\s*\%(\d\+\.\|[-+*]\)'
function! markdown#checkbox#toggle(...) abort
let c = a:0 ? a:1 : toupper(escape(nr2char(getchar()), '\.*'))
if c !~ '\p'
return
endif