Skip to content

Instantly share code, notes, and snippets.

{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.

Implicit Operands

Some instructions act on registers or even memory locations that are not stated in a list of operands. These instruction does do in fact have operands, but they represent assumptions made by the instruction. Implicit operands dose not change and cannot be changed. Most of the instruction that have implicit opeands dose have explicit operands as well.

MUL

The MUL instruction multiplies two values and returns the product. However, multiplication has a special problem: It generates output values that are often hugely lager than the input values. think of 0xffffffff * 0xffffffff. So to solve this problem the MUL instructison uses an implicit operands to store the product: by using two registers to hold our product.

[!Note]

@0x61nas
0x61nas / X86-64_GENERAL_PURPOSE_REGISTERS
Last active February 11, 2024 11:41
The general purpose registers(GPRs) in x64 processors
All x86-64 processors contain 16 64-bit wide general purpose registers.
Functions use thes registers to perform integer arithmetic, bitwise logical operations, comparisoins, address calculations, and data transfers.
A function can also store an intermediate or temporary result in one of those registres instead of saving it to memory.
╭──────────────────────────────────Quad Word────────────────────────────────────╮
│ ╭─────────────────Double Word────────────────╮│
│ │ ╭───────Word────────╮││
│ │ │ ╭─Byte──╮│││
╵ ╵ ╵ ╵ ╵╵╵╵
┇63 ┇31 ┇15 ┇7 0┃
@0x61nas
0x61nas / brain-tumor-detection.ipynb
Created February 10, 2024 23:28
Brain Tumor Detection.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Instruction Operands Description
MOV dist, source Copy the data from the source to the distnation register or memory
INC dist Increment the distnation register or memory by one
DEC dist Decrement the distnation register or memory by one
JNZ dist(label) Tests the value of Zero Flag and jump to the distnation if its not set(a.k.a. set o 0)
JMP dist Always jump to its operand
ADD dist, source Add the source value to the distnation
NOP n/a No operation, it takes some time to execute