Skip to content

Instantly share code, notes, and snippets.

View alexng353's full-sized avatar

Alexander Ng alexng353

View GitHub Profile
@alexng353
alexng353 / hyprland.conf
Last active June 22, 2024 10:01
Hyprland media binds
# https://wiki.archlinux.org/title/Xbindkeys
bindel=, XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+
bindel=, XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
bindl=, XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
bind=, XF86AudioNext, exec, playerctl next
bind=, XF86AudioPrev, exec, playerctl previous
bind=, XF86AudioPlay, exec, playerctl play-pause
@alexng353
alexng353 / react-capture-tabs.ts
Created June 16, 2024 18:16
Capture TAB in a react input
function InputCaptureTabs() {
const [input, set_input] = useState("");
return (<Input
multiline
placeholder="Type some code in"
value={users}
onChange={(event) => set_input(event.target.value)}
onKeyDown={(event) => {
if (event.key === "Tab") {
@alexng353
alexng353 / lsp.lua
Created May 24, 2024 05:51
Disable `tsserver` buffer formatting in lspconfig
-- https://neovim.discourse.group/t/autoformat-using-first-option-disable-formatting-on-tsserver/2500/3
require'lspconfig'.tsserver.setup{
on_attach = function(client)
client.server_capabilities.documentFormattingProvider = false
client.server_capabilities.documentRangeFormattingProvider = false
end,
}
@alexng353
alexng353 / alacritty.toml
Last active January 29, 2024 08:08
scuffed dotfiles
[font]
# size = 12
normal = { family = "Monaspace Neon", style = "Regular" }
italic = { family = "Monaspace Radon", style = "Italic" }
[shell]
program = "/bin/zsh"
@alexng353
alexng353 / cd.yml
Created December 30, 2023 09:53
Rust + Release-Please auto build release
# modified from https://github.com/railwayapp/cli/blob/master/.github/workflows/release.yml
# just replce every instance of "ENVX" or "envx" with your app name (or leave it, I don't care)
name: CD
on:
push:
branches:
- main
@alexng353
alexng353 / .nvimrc
Last active November 14, 2023 23:05
lazy.vim copilot configuration
filetype plugin indent on
" On pressing tab, insert 2 spaces
set expandtab
" show existing tab with 2 spaces width
set tabstop=2
set softtabstop=2
" when indenting with '>', use 2 spaces width
@alexng353
alexng353 / shell.rs
Last active November 16, 2023 02:32
[RUST] Determine current windows shell
/// get the parent process info, translated from
// https://gist.github.com/mattn/253013/d47b90159cf8ffa4d92448614b748aa1d235ebe4
fn get_parent_process_info() -> Option<(DWORD, String)> {
let mut pe32: PROCESSENTRY32 = unsafe { zeroed() };
let pid = unsafe { GetCurrentProcessId() };
let h_snapshot = unsafe { CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0) };
let mut ppid = 0;
if h_snapshot == INVALID_HANDLE_VALUE {
return None;
@alexng353
alexng353 / nextjs.yml
Last active May 9, 2024 04:08
Next JS build test GitHub action
# Sample workflow for building and deploying a Next.js site to GitHub Pages
#
# To get started with Next.js see: https://nextjs.org/docs/getting-started
#
name: Check NextJs build
on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]