Skip to content

Instantly share code, notes, and snippets.

View foxoman's full-sized avatar

Sultan Al Isaiee foxoman

View GitHub Profile
@foxoman
foxoman / nsm.nim
Created May 9, 2025 13:28
A tool to monitor nimsuggest processes and their memory consumption
# nsm.nim
# A tool to monitor nimsuggest processes and their memory consumption
# Created by FOXOMAN @ 2025
import os, osproc, strutils, strformat, parseopt, algorithm, math
import terminal
type
ProcessInfo = object
pid: int
@foxoman
foxoman / acme_client.nim
Created April 15, 2025 12:02
Nim ACME Client
# Nim ACME Client for SSL/TLS Certificate Management
## A high-performance RFC 8555 compliant ACME client for automated SSL/TLS certificate management
##
## This package provides a complete API for obtaining, managing, and renewing SSL/TLS certificates
## using the ACME protocol (RFC 8555), compatible with Let's Encrypt and other ACME providers.
##
## Basic usage example:
## ```nim
## import asyncdispatch
## import acme_client
@foxoman
foxoman / mybuildcmds.rst
Created March 12, 2025 08:58 — forked from planetis-m/mybuildcmds.rst
My build commands

Debug

nim c --cc:clang --mm:orc --panics:on --threads:on --tlsEmulation:off -l:"-fuse-ld=mold" %f

Release

@foxoman
foxoman / nim.cfg
Created March 12, 2025 08:58 — forked from planetis-m/nim.cfg
Top level nim.cfg
#cc = clang
--experimental:strictEffects
--experimental:strictFuncs
--experimental:strictDefs
--experimental:unicodeOperators
--experimental:overloadableEnums
--define:nimPreviewCstringConversion
--define:nimPreviewFloatRoundtrip
--define:nimStrictDelete
--define:nimUseLinenoise
@foxoman
foxoman / update-zed-nim-extesntion.sh
Created July 17, 2024 19:47
Shell script to update my nim Zed extestion in Zed Editor PM with one click
#!/bin/bash
# Set the extension name
EXTENSION_NAME="nim"
# Set the new version (edit this manually)
NEW_VERSION="0.0.2"
# Set the original repo URL
ORIGINAL_REPO="https://github.com/foxoman/zed-nim"
@foxoman
foxoman / memaddr.nim
Last active March 30, 2025 08:41
Cross-Platform Virtual Memory - Nim
# Cross-Platform Virtual Memory - Enhanced Security Version
##
## This module provides cross-platform virtual memory allocation with enhanced security features.
## It offers a consistent API across Windows and POSIX systems with additional security checks
## and protections against common memory-related vulnerabilities.
##
## Overview:
## - Cross-platform memory management between Windows (VirtualAlloc) and POSIX (mmap)
## - Enhanced security against common memory attacks
## - Protection against buffer overflows, integer overflows and memory leaks
@foxoman
foxoman / shellcode.nim
Last active January 22, 2024 16:49
Using native code/shellcode and assembly language with Nim
# ----------------------------------
# Shellcode Execution Utility in Nim
# ----------------------------------
# This Nim script is designed to execute a predefined shellcode,
# a small piece of low-level code used for various purposes.
# In this specific case, the shellcode is a function that performs
# hashing of a string.
#
# The script takes a hardcoded string "Fergo", loads the shellcode
# into memory, and then executes the shellcode using this string
@foxoman
foxoman / concepts.nim
Created March 8, 2023 00:46 — forked from PhilipWitte/concepts.nim
How to use concept in Nim
type
CanDance = concept x
dance(x) # `x` is anything that has a `dance` procedure
proc doBallet(dancer: CanDance) =
# `dancer` can be anything that `CanDance`
dance(dancer)
# ---
@foxoman
foxoman / main.nim
Last active February 10, 2023 16:36
USING NIM TO GENERATE A DLL FOR USE IN C#/VB6-C#
{.passc:"-m32"}
{.passl:"-m32"}
import winim,os
#nim c --cpu:i386 --app:lib --nomain
# https://www.appsloveworld.com/csharp/100/446/using-nim-to-generate-a-dll-for-use-in-c-vb6
proc TestFunc(a: cint):cint {.exportc, stdcall, dynlib.} =
echo "function called!"
a + 5
@foxoman
foxoman / parallel.nim
Created December 21, 2022 19:32 — forked from trickster/parallel.nim
Parallel stuff in Nim
import threadpool, tables, strutils
const
filesArray = ["data1.txt", "data2.txt", "data3.txt"]
proc countWords2(filename: string): CountTableRef[string] =
result = newCountTable[string]()
for word in readFile(filename).splitWhitespace():
result.inc word