Skip to content

Instantly share code, notes, and snippets.

@nemolize
nemolize / system-auth
Last active December 4, 2024 07:25
This setting enables linux login with your U2F device. The file location is `/etc/pam.d/system-auth`
#%PAM-1.0
auth required pam_faillock.so preauth
# Optionally use requisite above if you do not want to prompt for the password
# on locked accounts.
# The following 2 lines enables you to login with both Yubikey and password
# Thanks: https://cromwell-intl.com/cybersecurity/yubikey/pam_u2f.html
auth sufficient pam_unix.so try_first_pass nullok
auth sufficient pam_u2f.so cue
@nemolize
nemolize / fix-php-build-error.sh
Created December 1, 2021 02:10
Workaround if PHP 7.4.7 installation with phpenv fails with "error: ‘TRUE’ undeclared (first use in this function)"
# Ref: https://zenn.dev/kumamidori/articles/b6f79df64753bb
export CFLAGS="-Wno-error=implicit-function-declaration -DU_DEFINE_FALSE_AND_TRUE=1"
export CXXFLAGS="-Wno-error=implicit-function-declaration -DU_DEFINE_FALSE_AND_TRUE=1"
@nemolize
nemolize / idea.properties
Created November 23, 2021 17:37
Use Windows keys as Meta keys in JetBrains IDEs
# custom IntelliJ IDEA properties
# NOTE: specify the following property to use windows keys as meta keys. see https://youtrack.jetbrains.com/issue/IDEA-144702
keymap.windows.as.meta=true
@nemolize
nemolize / environment
Created November 16, 2021 01:24
etc/environment settings to enable fcitx for JetBrains IDEs
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx
@nemolize
nemolize / grub
Created October 20, 2021 00:12
How to fix Ryzen soft lockup problem on Linux
# add "processor.max_cstate=1 pcie_aspm=off" options to GRUB_CMDLINE_LINUX like the following
GRUB_CMDLINE_LINUX="processor.max_cstate=1 pcie_aspm=off"
@nemolize
nemolize / environment
Created September 26, 2021 16:55
Avoid micro stuttering on Linux with 144Hz and 60Hz monitors
# /etc/environment
CLUTTER_DEFAULT_FPS=144
__GL_SYNC_DISPLAY_DEVICE=DP-2
@nemolize
nemolize / import-keybase-for-verified-git-commits.sh
Last active May 19, 2022 14:40
Sign your git commits with a key imported from keybase
# NOTE: Assuming you have already installed keybase and logged in
# This is only for WSL. see: https://github.com/microsoft/WSL/issues/4029
export GPG_TTY=$(tty)
# import your public/private keys from keybase
keybase pgp export | gpg --import
keybase pgp export --secret | gpg --allow-secret-key --import --batch
# show your imported keys
@nemolize
nemolize / screenshot.png
Last active September 24, 2020 15:32
Custom keyboard layout file which disables symbols with alt + letter on mac.
screenshot.png

Keybase proof

I hereby claim:

  • I am nemolize on github.
  • I am nemolize (https://keybase.io/nemolize) on keybase.
  • I have a public key whose fingerprint is CE91 6E32 B769 A792 A743 EC03 AB22 03C1 5744 FF24

To claim this, I am signing this object:

@nemolize
nemolize / MoveWindow.swift
Created July 25, 2020 20:11
These function demonstrates how to change coordinate of the focused window
func moveWindow(_ appRef: AXUIElement, _ velocity: CGPoint) {
do {
var windowRef: AnyObject?
try appRef.copyAttributeValue(kAXFocusedWindowAttribute, &windowRef)
let windowElement: AXUIElement = windowRef as! AXUIElement
var positionRef: CFTypeRef?
try windowElement.copyAttributeValue(kAXPositionAttribute, &positionRef)
var position = CGPoint()