Skip to content

Instantly share code, notes, and snippets.

View Scherso's full-sized avatar
💭
crabs?

Sam Scherso

💭
crabs?
  • Washington, D.C.
  • 00:19 (UTC -04:00)
View GitHub Profile
#include <stdio.h>
void swap(int* a, int* b)
{
int temp = *a;
*a = *b;
*b = temp;
}
int partition(int arr[], int low, int high)
bits 64
section .text
global _start
_start:
push NUM_FORKS
.loop:
mov rax, SYS_FORK ; Moving '57' into 'rax', syscall for 'stub_fork()'.
@Scherso
Scherso / lunar.sh
Last active May 7, 2023 20:42
A script to launch Lunar client with the addition of the Weave-Agent.
#!/usr/bin/env bash
# Add your JVM Args here.
declare -r LUNAR_JVM_ARGS="\
--add-modules jdk.naming.dns \
--add-exports jdk.naming.dns/com.sun.jndi.dns=java.naming \
-Djna.boot.library.path=natives \
-Dlog4j2.formatMsgNoLookups=true \
--add-opens java.base/java.io=ALL-UNNAMED \
-Xms3072m \
@Scherso
Scherso / EvenOrOdd.c
Last active April 4, 2023 16:36
Uses for Bitwise operators
#include <stdio.h>
#include <stdlib.h>
/**
* Checking whether a number is even or odd,
*
* A base ten '2' is equal to a base-two '0010'.
* When using a bitwise 'and' on the numbers '0001'
* and '0010' there are no matching digits, meaning
* a return of only zeros.
@Scherso
Scherso / headers.h
Last active April 19, 2023 17:52
‘Hello, World!’ C program made without the use of C's Standard Library
#define WRITE 1
#define STDOUT 1
#define EXIT 60
#define EXIT_SUCCESS 0

Writing C Software without the Standard Library
FOR UN*X


There are many tutorials on the web that explain how to build a simple "Hello, World" in C without the use of libc on AMD64, but most of them stop there.

This guide hopes to provide a more complete explanation that will allow you to build yourself a small framework to write more complex programs. The code will support both AMD64, and i386.

Variables

Is that a Variable!?

ex: j, myVar, _inT

Back to _inT, this is a bad variable because it uses a reserved word, and had a leading underscore, which should only be used for device drivers, and lower level system development.

  • Another example of a bad variable is password$, this is because the $ indicates security.
@Scherso
Scherso / xmonadwinefix.md
Last active February 11, 2023 19:28
Fix for the "Wine System Tray" appearing on XMonad when using Wine.

Wine System Tray Fix for Xmonad

If you have used Xmonad and Wine on any Windows applications, you have probably noticed a window popping up with a logo of the app you're using. Here's a fix.

  • Firsty, find your xmonad.hs file, and edit it with your editor of choice.
@Scherso
Scherso / WaysToBrickAUnixSystem.md
Last active May 7, 2023 01:02
Guide to installing OpenBSD

Ways To Not Use Your Unix Machine

(Run these as root :trollface:)

rm Remove Command

@Scherso
Scherso / MacBook-Air-9-1-T2-Arch-Install.md
Last active December 31, 2023 17:45
Macbook Air 2020 T2 Arch Linux Installation Guide