Skip to content

Instantly share code, notes, and snippets.

View alirezaarzehgar's full-sized avatar
😃
Focusing

Ali alirezaarzehgar

😃
Focusing
View GitHub Profile
@alirezaarzehgar
alirezaarzehgar / hello_world.c
Created April 7, 2023 07:25
Hello world in c without stdlib using assembly
char msg[] = "Hello, World!\n";
void _start()
{
asm(
"movl $1, %eax\n"
"movl $1, %edi\n"
"movl $msg, %esi\n"
"movl $14, %edx\n"
"syscall\n"
@alirezaarzehgar
alirezaarzehgar / report
Last active May 2, 2023 09:16
An small fun report system with bash
#!/usr/bin/env bash
tmp=$(mktemp)
vim ${tmp}
if [ ! -s ${tmp} ]; then
echo "Do not report empty text"
rm -rf ${tmp}
exit 1
fi
@alirezaarzehgar
alirezaarzehgar / cheat.patch
Created May 4, 2023 09:43
Change mari0 source code to unlock mario abilities and place some cheats.
diff --git a/game.lua b/game.lua
index 11ca5fc..5134d77 100644
--- a/game.lua
+++ b/game.lua
@@ -14,11 +14,11 @@ function game_load(suspended)
--LINK STUFF
- mariocoincount = 0
- marioscore = 0
@alirezaarzehgar
alirezaarzehgar / applock.go
Last active May 13, 2023 22:07
Lock applications
package main
import (
"bufio"
"errors"
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
@alirezaarzehgar
alirezaarzehgar / main.cpp
Last active May 15, 2023 10:16
students
#include <iostream>
#include <vector>
using namespace std;
class Student
{
private:
int age, score;
string name;
@alirezaarzehgar
alirezaarzehgar / main.go
Last active July 1, 2023 20:07
database/sql demo
package main
import (
"database/sql"
"errors"
"os"
"strconv"
_ "github.com/mattn/go-sqlite3"
"github.com/pterm/pterm"
@alirezaarzehgar
alirezaarzehgar / rsug.go
Last active July 8, 2023 09:27
Suggestions assistant
package main
import (
"encoding/json"
"log"
"math"
"math/rand"
"os"
"time"
@alirezaarzehgar
alirezaarzehgar / main.go
Created July 11, 2023 19:21
Self-Referential Has One in GORM
package main
import (
"fmt"
"log"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
)
@alirezaarzehgar
alirezaarzehgar / rumination.go
Created July 31, 2023 11:27
I use this snippet for counting my mind ruminations. I think this technique can stop rumination after some times.
package main
import (
"errors"
"fmt"
"io/fs"
"log"
"os"
"strconv"
)
@alirezaarzehgar
alirezaarzehgar / server.go
Created August 17, 2023 05:09
Simplest golang websocket chat server
package main
import (
"log"
"net/http"
"github.com/gorilla/websocket"
)
func main() {