Skip to content

Instantly share code, notes, and snippets.

// A small test program of me trying Odin + Box2D + Raylib
// Made during this stream: https://www.youtube.com/watch?v=LYW7jdwEnaI
// I used these bindings https://github.com/cr1sth0fer/odin-box2d download them and put them in a sub-folder "box2d" next to this file.
// Then you can build using `odin run .`
package game
import b2 "box2d"
import rl "vendor:raylib"
@rauchg
rauchg / p.sh
Last active April 27, 2024 10:43
Perplexity CLI in pure shell
#!/usr/bin/env bash
function p() {
jq -n \
--arg content "$*" \
'{
"model": "pplx-7b-online",
"messages": [
{
"role": "system",
"content": "Be precise and concise."
@nir9
nir9 / gui.c
Created January 7, 2024 15:16
Simple X11 Window Creation in C - Not for production, only for fun (gcc gui.c -lX11)
#include <X11/Xlib.h>
int main() {
XEvent event;
Display* display = XOpenDisplay(NULL);
Window w = XCreateSimpleWindow(display, DefaultRootWindow(display), 50, 50, 250, 250, 1, BlackPixel(display, 0), WhitePixel(display, 0));
XMapWindow(display, w);
XSelectInput(display, w, ExposureMask);
for (;;) {
@nir9
nir9 / server.c
Created November 25, 2023 16:50
Minimalist C Web Server - not for production use, only for fun :)
#include <sys/socket.h>
#include <string.h>
#include <fcntl.h>
#include <sys/sendfile.h>
#include <unistd.h>
#include <netinet/in.h>
void main() {
int s = socket(AF_INET, SOCK_STREAM, 0);
struct sockaddr_in addr = {
@alexedwards
alexedwards / Makefile
Last active April 26, 2024 17:21
Boilerplate Makefile for Go projects
# Change these variables as necessary.
MAIN_PACKAGE_PATH := ./cmd/example
BINARY_NAME := example
# ==================================================================================== #
# HELPERS
# ==================================================================================== #
## help: print this help message
.PHONY: help
# juggling_balls_game.py
import turtle
import time
import random
from juggling_balls import Ball
# Game parameters
WIDTH = 600
# juggling_balls.py
import random
import turtle
class Ball(turtle.Turtle):
MAX_VELOCITY = 5
GRAVITY = 0.07
BAT_VELOCITY_CHANGE = 8
@BjoernSchilberg
BjoernSchilberg / tetris.py
Created December 8, 2022 18:49 — forked from timurbakibayev/tetris.py
Tetris game in Python
import pygame
import random
colors = [
(0, 0, 0),
(120, 37, 179),
(100, 179, 179),
(80, 34, 22),
(80, 134, 22),
(180, 34, 22),
@sago35
sago35 / launch.json
Last active February 13, 2022 17:54
TinyGo + VSCode + Cortex-Debug for Wio Terminal (ATSAMD51P19A)
{
"version": "0.2.0",
"configurations": [
{
"type": "cortex-debug",
"servertype": "openocd",
"request": "launch",
"name": "tinygo-debug",
"runToEntryPoint": "main.main",
"executable": "${workspaceRoot}/out.elf",
@samwightt
samwightt / go.mod
Last active February 16, 2022 07:20
Ebiten example with perlin noise generation
module samw.dev/ebiten
go 1.15
require (
github.com/aquilax/go-perlin v1.1.0
github.com/hajimehoshi/ebiten/v2 v2.2.4
)