Skip to content

Instantly share code, notes, and snippets.

View alexng353's full-sized avatar
:shipit:
rat :3

Alexander Ng alexng353

:shipit:
rat :3
View GitHub Profile
@alexng353
alexng353 / nextjs.yml
Last active October 25, 2024 16:52
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"]
@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 / .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 / 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 / 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 / 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 / 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 / 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 / conditions.ts
Last active October 12, 2024 07:15
Bun script for watching and hot rebuilding tsoa + express
import { FileChangeInfo } from "node:fs/promises";
type ConditionFn = (event: FileChangeInfo<string>) => boolean;
type Conditions = {
[key: string]: ConditionFn | undefined;
};
export const defaultCondition = (event: FileChangeInfo<string>) => {
if (!event.filename) return false;
return event.filename?.startsWith("src") && event.filename.endsWith("~");
@alexng353
alexng353 / instructions.md
Last active August 30, 2024 22:08
Baritone Dev Releaes Installation Instructions

How to install Baritone Development Releases

Feel free to follow these instructions 1 step at a time. Reading the entire thing before you start is not necessary. I would, however, recommend that you read each instruction thoroughly before actually doing the instruction.

Grayed out text is for memes, you don't need to read it.

Guide exists because I'm tired of texting the same stuff over and over again

Disclaimers: