Skip to content

Instantly share code, notes, and snippets.

View 0x61nas's full-sized avatar
💭
I may be slow to respond.

0x61nas

💭
I may be slow to respond.
View GitHub Profile
-- I use Dvorak layout, so.. no hjkl :|
-- Instead, I will use -kcd
local modes = {'n', 'v', 's', 'o'} -- Normal, visual, select, operator-pending
local keys = {{'h', '-'}, {'j', 'c'}, {'l', 'd'}}
for _, mode in ipairs(modes) do
for _, key in ipairs(keys) do
map(mode, key[1], key[2], {noremap = true})
map(mode, key[2], key[1], {noremap = true})
end
end
{
description = "NextJS Template";
inputs = {
nixpkgs.url = "nixpkgs";
systems.url = "github:nix-systems/x86_64-linux";
utils = {
url = "github:numtide/flake-utils";
inputs.systems.follows = "systems";
};
{ lib, pkgs, ... }:
{
home.packages = with pkgs; [ delta ];
programs.git = {
enable = true;
userName = "0x61nas";
userEmail = "[email protected]";
ignores = [ "*~" ];
signing = {
#signByDefault = true;
{ lib, pkgs, config, ... }:
{
services.gpg-agent = {
enable = true;
enableSshSupport = true;
# Cache the PIN for 3 hours
defaultCacheTtl = 3600*3;
#grabKeyboardAndMouse = false;
#pinentryPackage = pkgs.pinentry;
};
{lib, pkgs, ... }:
{
# Download the prompt
home.file.".config/zsh/prompt.zsh".source = builtins.fetchurl {
url = "https://gist.githubusercontent.com/0x61nas/6ee08add16a0ac8f63bfc485be5239f0/raw/100a7fecc752b6fe0ce564124a3c1e660ce18b7a/prompt.zsh";
sha256 = "0cl2ml4z62yiwn0n5wk6bj4zsf5avjl643c66k2p0m2bfa8a2pwk";
};
programs.zsh = {
enable = true;
function shrink_path {
# Replace the home directory with ~ for brevity
local path="${PWD/#$HOME/~}"
local new_path=""
local -a path_components=("${(@s:/:)path}")
local num_components=${#path_components[@]}
# Loop through each component except the last one
for (( i=1; i < num_components; i++ )); do
if [[ -n ${path_components[i]} ]]; then
new_path+="%{$fg[yellow]%}${path_components[i][1]}%{$reset_color%}%{$fg[white]%}:%{$reset_color%}"
@0x61nas
0x61nas / CompleteDiscordQuest.md
Created April 26, 2024 14:34 — forked from aamiaa/CompleteDiscordQuest.md
Complete Recent Discord Quest

Complete Recent Discord Quest

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
  2. Join a vc
  3. Stream any window (can be notepad or something)
  4. Press Ctrl+Shift+I to open DevTools
  5. Go to the Console tab
  6. Paste the following code and hit enter:
let wpRequire;
# This is your system's configuration file.
# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix)
{
inputs,
lib,
config,
pkgs,
...
}: {
# You can import other NixOS modules here
@0x61nas
0x61nas / linux-sys-calls.md
Last active September 23, 2024 09:54
x86-64 linux syscalls

Ordinary user-space programs that written in NASM for Linux are divided into three sections: .data, .bss, and .text. The older in which these sections fall in your program really doesn't matter, but by convention the .data section comes first, followed by .bss section and then the .text section.

.data

The .data section contains data deffinitions of initialized data items.

Initialized data is data that has a value before the program begins running. These values are part of the executable file. They are loaded into memory when the executable file is loaded into memrory for execution.

Note

That you don't load the data defined in .data section manually, and no machine cycles are used in there certion beyond what it takes to load the program as a whole into memory.