Skip to content

Instantly share code, notes, and snippets.

View JosiasAurel's full-sized avatar

Josias Aurel JosiasAurel

View GitHub Profile
@JosiasAurel
JosiasAurel / gist:4141951884775cacbeb56f2cbacc8146
Created July 6, 2024 12:02
count the number of lines of source code in a git project
git ls-files | grep -v -e ".json" -e ".jpg" -e ".svg" -e ".ico" | xargs wc -l
import os
import requests
from dotenv import load_dotenv
from typing import List
import json
# load environment variables
load_dotenv()
# credentials
/*
@title: Gravity Box
@author: Josias Aurel
*/
const player = "p"
const wall = "w"
const goal = "g"
/*
First time? Check out the tutorial game:
https://sprig.hackclub.com/gallery/getting_started
*/
const player = "p"
const wall = "w"
const goal = "g"

Git standard commands

Configuring your git accounts locally

Setting your git username

git config --global user.name "JosiasAurel"
@JosiasAurel
JosiasAurel / sinerider-hit.js
Last active May 18, 2023 15:50
A script I use to hit the sinerider-scoring service with sveral requests locally for testing
async function hitService(numRequests) {
const level = "https://sinerider.hackclub.dev/?N4IgbiBcAMB0CMAaEA7AlgYwNZRAZQBkB5ABQFEB9AOTIHEBBAFQEkA1MkZDAewFsAHADYBTAC7CAJlFEAnAK7DkAZwCGYSQRXiAHrgC0u5AHNuKwUqgo5gwQF8gA===";
for (let i = 0; i < numRequests; i++) {
console.log("Making request");
const req = await fetch("https://sinerider-scoring-od9e5.ondigitalocean.app/score", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
board = [i for i in range(9)]
is_win = False # keeps track of whether there is a winner or not
def print_board():
count = 0
for i in board:
if count == 3 or count == 6:
print()
print(i, end=" ")
@JosiasAurel
JosiasAurel / autobuild.py
Created June 22, 2022 13:50
A script to watch file changes in your project directory and automatically run commands
import subprocess
import sys
import time
import json
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
# load config
with open("autobuild.json", "r") as config_file:
#include <stdio.h>
#define N 5
static int A[N][N];
void fillMagicSquare();
typedef struct TupleTwo
{
@JosiasAurel
JosiasAurel / pascal triangle.c
Created June 4, 2022 03:47
My simple implemetation of pascal's triangle in C
#include <stdio.h>
int fact(int n) {
return n == 0 || n == 1 ? 1 : n*fact(n-1);
}
int main(int argc, char** argv)
{
int n;
printf("Enter the value of n : ");