Skip to content

Instantly share code, notes, and snippets.

View imabuddha's full-sized avatar
👨‍💻
Looking for work

John Mifsud imabuddha

👨‍💻
Looking for work
View GitHub Profile
@imabuddha
imabuddha / 50-system-apple.quirks
Created December 10, 2020 13:50
Apple Magic Trackpad 2 configuration for Raspberry Pi (& linux generally) — Properly configures the pressure sensitivity, natural scrolling, and the left/right/middle (1/2/3 finger) clicks.
# add this to /usr/share/libinput/50-system-apple.quirks (create if doesn't exist)
[Apple Magic Trackpad v2]
MatchName=*Magic Trackpad 2
AttrSizeHint=162x115
AttrTouchSizeRange=20:10
AttrPressureRange=2:0
AttrPalmSizeThreshold=900
AttrThumbSizeThreshold=700
@imabuddha
imabuddha / dbus-action.conf
Last active November 17, 2021 08:12
Configure dbus-action for magic trackpad gestures after bluetooth or usb connect [Raspberry Pi OS: not an ideal solution as the dm doesn't emit useful events, especially when connecting via usb]
# Configuration file for dbus-action. Mark Blakeney, Apr 2020
#
# The default configuration file exists at /etc/dbus-action.conf. A user
# can create a personal custom configuration file by copying that to
# ~/.config/dbus-action.conf and adding entries. This file is YAML
# format, see https://en.wikipedia.org/wiki/YAML.
# List of trigger definitions. Each trigger must define:
# bus: Must be "session" or "system".
# interface: Interface name, e.g. org.freedesktop.DBus.
@imabuddha
imabuddha / Start ssh-agent on login.md
Created December 8, 2020 09:14
Start ssh-agent on login, still need to enter passphrase once when used

On Arch Linux, the following works really great (should work on all systemd-based distros):

Create a systemd user service, by putting the following to ~/.config/systemd/user/ssh-agent.service:

[Unit]
Description=SSH key agent

[Service]
Type=simple

Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket

@imabuddha
imabuddha / xsessionerrors
Last active January 23, 2021 08:54
Keep ~/.xsession-errors log file from growing too large. Place file in /etc/logrotate.d
$HOME/.xsession-errors {
missingok
notifempty
size 1M
daily
rotate 3
}

Chrome theme manifest.json color props

more info: https://developer.chrome.com/docs/extensions/mv3/themes/

// Strings used by themes to identify colors in the JSON.
constexpr StringToIntTable kOverwritableColorTable[] = {
    {"frame", TP::COLOR_FRAME_ACTIVE},
    {"frame_inactive", TP::COLOR_FRAME_INACTIVE},
    {"frame_incognito", TP::COLOR_FRAME_ACTIVE_INCOGNITO},
@imabuddha
imabuddha / rc.lua
Last active January 23, 2021 03:51
Awesome window manager config, place in ~/.config/awesome/
-- jdm — customized awesome wnd mgr config
-- If LuaRocks is installed, make sure that packages installed through it are
-- found (e.g. lgi). If LuaRocks is not installed, do nothing.
pcall(require, "luarocks.loader")
-- prevent hotkeys_popup from showing tmux keys
package.loaded["awful.hotkeys_popup.keys.tmux"] = {}
-- Standard awesome library
@imabuddha
imabuddha / theme.lua
Last active January 23, 2021 03:51
altered version of default awesome theme—place in ~/.config/awesome/themes/default/
---------------------------
-- jdm awesome theme --
---------------------------
local theme_assets = require("beautiful.theme_assets")
local xresources = require("beautiful.xresources")
local gears = require("gears")
local dpi = xresources.apply_dpi

Git push results in “Authentication Failed”

If you enabled two-factor authentication in your Github account you won't be able to push via HTTPS using your accounts password. Instead you need to generate a personal access token. This can be done in the application settings of your Github account. Using this token as your password should allow you to push to your remote repository via HTTPS. Use your username as usual.

https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/

You may also need to update the origin for your repository if set to https:

git remote -v 
@imabuddha
imabuddha / - README.md
Created January 18, 2021 08:05
awful.widget.watch use case examples from: https://awesomewm.org/recipes/watch/

iostat

-- disk I/O using iostat from sysstat utilities
local iotable = {}
local iostat = awful.widget.watch("iostat -dk", 2, -- in Kb, use -dm for Mb
    function(widget, stdout)
        for line in stdout:match("(sd.*)\n"):gmatch("(.-)\n") do
            local device, tps, read_s, wrtn_s, read, wrtn =
            line:match("(%w+)%s*(%d+,?%d*)%s*(%d+,?%d*)%s*(%d+,?%d*)%s*(%d+,?%d*)%s*(%d+,?%d*)")
 -- [1] [2] [3] [4] [5]
@imabuddha
imabuddha / - README.md
Last active January 16, 2021 09:21
by default the Awesome window mgr doesn't run the programs in `~/.config/autostart`

Get Awesome to respect xdg/autostart

See also Arch Wiki for alternatives & other useful awesome tips.

Add the following to ~/.config/awesome/rc.lua:

local xresources_name = "awesome.started"
local xresources = awful.util.pread("xrdb -query")
if not xresources:match(xresources_name) then