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 ruby | |
# I haven't tested this lately but it did work at some point in time. | |
require 'rubygems' | |
require 'RMagick' | |
include Magick | |
Dir.new(".").entries.each do |src_name| |
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
(defcfg | |
input (device-file "/dev/input/by-id/usb-USB_Keychron_K2_USB_DEVICE-event-kbd") | |
output (uinput-sink | |
"KMonad" | |
"sleep 0.2s; xset r rate 230 70; sleep 0.2s; setxkbmap -option compose:menu") | |
) | |
#| -------------- Keeb Pattern ------------------------------ | |
(deflayer name | |
esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 ins prnt del |
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 GetChoices(input) | |
local choices = {} | |
for directory in input:gmatch("[^\r\n]+") do | |
table.insert(choices, {["text"] = directory}) | |
end | |
for key, _ in pairs(actions) do | |
table.insert(choices, {["text"] = key}) | |
end | |
return choices; | |
end |
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
appToggle = function (appName, appBundle) | |
local app = hs.application.get(appBundle) | |
if app then | |
if not app:mainWindow() then | |
app:selectMenuItem({app, "New OS window"}) | |
elseif app:isFrontmost() then | |
app:hide() | |
else | |
app:activate() | |
end |
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
-- maximize main window of app, leave margin all around it | |
appMaximizeWithBorder = function (appBundle) | |
local app = hs.application.get(appBundle) | |
if app then | |
win = app:mainWindow() | |
screenSize = win:screen():fullFrame() | |
local marginTop = 40 | |
local marginRBL = 16 -- margin Right, Bottom, Left | |
local winRectangle = hs.geometry.rect( | |
marginRBL, marginTop, |
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
hs.hotkey.bind({"cmd", "ctrl", "alt", "shift"}, "f2", | |
-- next function is called on hotkey press | |
function() | |
hs.eventtap.event.newKeyEvent({}, "space", true):post() | |
hs.eventtap.event.newMouseEvent(hs.eventtap.event.types["leftMouseDown"], hs.mouse.absolutePosition()):post() | |
end, | |
function() | |
-- next function is called on hotkey release | |
hs.eventtap.event.newKeyEvent({}, "space", false):post() | |
hs.eventtap.event.newMouseEvent(hs.eventtap.event.types["leftMouseUp"], hs.mouse.absolutePosition()):post() |
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
hs.hotkey.bind({"cmd", "ctrl", "alt", "shift"}, "f1", | |
-- next function is called on hotkey press | |
function() | |
startPoint = hs.mouse.absolutePosition() | |
end, | |
-- this is called on hotkey release | |
function() end, | |
-- this is called while the key remains pressed | |
function() | |
local point = hs.mouse.absolutePosition() |
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
menubar = hs.menubar.new(true) | |
menubar:setTitle("Menu") | |
menubarCount = 0 | |
function menubarClicked() | |
menubar:setTitle("Updated! "..menubarCount) | |
menubarCount = menubarCount + 1 | |
-- menubar:removeFromMenuBar() | |
-- menubar:delete() | |
end | |
if menubar 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
hs.eventtap.new({"all"}, | |
function(event) | |
print(event:getKeyCode()) | |
end | |
):start() | |
outputFilePath = "/Users/grn/keylogger.txt" | |
local function writeToFile(key) | |
outputFileHandle = io.open(outputFilePath, 'a') | |
if key == "return" 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
// run this in the JS console - needs a bit of love to be added to Tampermonkey | |
lastKnownScrollPosition = window.scrollY; | |
document.addEventListener('scroll', function(e) { | |
if (Math.abs(window.scrollY - lastKnownScrollPosition) > 50) { | |
lastKnownScrollPosition = window.scrollY; | |
// "Promoted" post | |
document.querySelectorAll("[data-entity-hovercard-id]").forEach(e => { a=e.getAttribute("data-entity-hovercard-id"); if (a.includes('urn:li:fs_miniCompany')) { f=e.parentElement.parentElement.parentElement; if (f.hasAttribute('data-urn')) f.remove();}}); | |
//remove "Jobs Recommended for You" |
NewerOlder