Skip to content

Instantly share code, notes, and snippets.

View JosiasAurel's full-sized avatar
🏠
Working from home

Josias JosiasAurel

🏠
Working from home
View GitHub Profile

Dependencies

If you own a laptop, and you have Python and a code editor such as Visual Studio Code installed, I will need you to install a few dependencies that we will need for our WhatsApp bot project for the last class.

Please run the following commands in order to install the required dependencies

  • Install the OpenAI Python package (This will help us interact with ChatGPT/GPT-4)
pip3 install openai
@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
{