Skip to content

Instantly share code, notes, and snippets.

View kiinoda's full-sized avatar

George R. NICA kiinoda

  • Infinium
  • Romania, Bucharest
  • X @kiiNODA
View GitHub Profile
@kiinoda
kiinoda / roundpics.rb
Created November 1, 2023 11:03
round corners for your png pics
#!/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|
@kiinoda
kiinoda / gist:1baadc63cce518214460fa8b1172f27f
Created September 3, 2023 18:54
kmonad - Colemak w/ left-shifted bottom row and extended layer
(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
@kiinoda
kiinoda / init.lua
Created January 17, 2023 09:45
Hammerspoon Problems with hs.chooser queryChangedCallback()
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
@kiinoda
kiinoda / init.lua
Created November 2, 2022 09:25
Hammerspoon - show/hide app on hotkey press
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
@kiinoda
kiinoda / init.lua
Created November 2, 2022 09:18
Hammerspoon - maximize main window of app, leave margin all around it
-- 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,
@kiinoda
kiinoda / init.lua
Created November 2, 2022 07:47
Hammerspoon - press space+left_click on key press (used in Photoshop)
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()
@kiinoda
kiinoda / init.lua
Created November 2, 2022 07:45
Hammerspoon - undo/redo on mouse left/right on keypress
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()
@kiinoda
kiinoda / init.lua
Created November 2, 2022 07:42
Hammerspoon - simple menu
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
@kiinoda
kiinoda / keylogger.lua
Created November 2, 2022 07:41
Hammerspoon / Lua - basic keylogger
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
@kiinoda
kiinoda / clean_linkedin.js
Created October 27, 2021 11:23
LinkedIn cleanup.
// 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"