This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function prepareForScreenshot(selector) { | |
var textElements = document.querySelectorAll(selector); | |
for (i = 0; i < textElements.length; ++i) { | |
textElements[i].innerHTML = randomiseString(textElements[i].textContent); | |
} | |
var imgElements = document.querySelectorAll('img'); | |
for (i = 0; i < imgElements.length; ++i) { | |
imgElements[i].style.filter = 'blur(7px)'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
ffmpeg -loglevel panic\ | |
-f x11grab\ | |
-video_size $(xdpyinfo | grep dimensions | sed -r 's/^[^0-9]*([0-9]+x[0-9]+).*$/\1/')\ | |
-y -i :0.0\ | |
-filter_complex "boxblur=9"\ | |
-vframes 1\ | |
/tmp/i3lock.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
ffmpeg -loglevel panic\ | |
-f x11grab\ | |
-video_size $(xdpyinfo | grep dimensions | sed -r 's/^[^0-9]*([0-9]+x[0-9]+).*$/\1/')\ | |
-y -i :0.0\ | |
-vf frei0r=pixeliz0r\ | |
-vframes 1\ | |
/tmp/i3lock.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LOCKSCREENIMG='/tmp/lockscreen.png' | |
pgrep i3lock || ffmpeg -loglevel panic -f x11grab -video_size $(xdpyinfo | grep dimensions | sed -r 's/^[^0-9]*([0-9]+x[0-9]+).*$/\1/') -y -i :0.0+$1,20 -i /opt/lockscreen/uac-removebg.png -filter_complex "boxblur=9,overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2" -vframes 1 $LOCKSCREENIMG | |
i3lock -i $LOCKSCREENIMG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## Usage: print-gh-contrib-graph username num_of_days | |
## | |
## username GitHub username. | |
## num_of_days Number of days in the past to print graph for. | |
## | |
function print_graph { | |
if [ "$#" -ne 2 ]; then | |
echo "Expected 2 arguments: username and a number of days" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function ellipsize(text, length) | |
return (text:len() > length and length > 0) | |
and text:sub(0, length - 3) .. '...' | |
or text | |
end | |
--- Converts seconds to "time ago" represenation, like '1 hour ago' | |
local function to_time_ago(seconds) | |
local days = seconds / 86400 | |
if days > 1 then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local fade_widget = wibox.widget { | |
{ | |
id = 'icon', | |
image = '/usr/share/icons/Yaru/24x24/apps/org.gnome.PowerStats.png', | |
widget = wibox.widget.imagebox | |
}, | |
{ | |
id = 'text', | |
text = 'Click to fade', | |
widget = wibox.widget.textbox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension NSColor { | |
/// NSColor initializer accepting hex color string | |
/// | |
/// ``` | |
/// NSColor(hex: "#BADA55") | |
/// ``` | |
/// | |
/// - Parameter hex: Hex color string, may include a hash (#) prefix | |
/// - Returns: an NSColor of given hex color string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Date { | |
func getElapsedInterval() -> String { | |
let interval = Calendar.current.dateComponents([.year, .month, .day, .hour, .minute, .second], from: self, to: Date()) | |
if let year = interval.year, year > 0 { | |
return "\(year) year\(year == 1 ? "" : "s") ago" | |
} else if let month = interval.month, month > 0 { | |
return "\(month) month\(month == 1 ? "" : "s") ago" |
OlderNewer