Skip to content

Instantly share code, notes, and snippets.

View paulfrische's full-sized avatar
🍕

Paul paulfrische

🍕
View GitHub Profile
@paulfrische
paulfrische / http_server.py
Created July 18, 2022 10:26
A very simple http server which always returns "lol" as response
import socket
HOST = "127.0.0.1"
PORT = 8080
RESPONSE = """HTTP/1.1 200 OK
Content-Length: 3
Content-Type: text/plain
lol"""
@paulfrische
paulfrische / ogl_triangle.cpp
Created October 2, 2022 20:07
first triangle in opengl
#include <iostream>
#define GLEW_STATIC
#include <GL/glew.h>
#include <GLFW/glfw3.h>
const char *vertex_shader_source =
"#version 330 core\n"
"layout (location = 0) in vec3 pos;\n"
@paulfrische
paulfrische / ogl_triangle.rs
Created October 7, 2022 18:39
Hello World OpenGL Triangle in Rust
extern crate glfw;
extern crate gl;
use glfw::{Action, Context, Key};
use std::{os::raw::*, ffi::CString, ptr, mem};
fn main() {
let vertex_shader_source = String::from("
#version 330 core
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'dracula/tmux'
# fix colors in neovim
set -g default-terminal "screen-256color"
set -ga terminal-overrides ",xterm-256color*:Tc"
# set prefix
set -g prefix C-a
@paulfrische
paulfrische / client.py
Created July 19, 2023 10:49
dirty implementation of "multiplayer" in pygame with sockets
import pygame
import socket
import threading
ADDRESS = ('127.0.0.1', 8000)
position1 = (0, 0)
position2 = (0, 0)
pygame.init()
@paulfrische
paulfrische / quick-sort.py
Created August 27, 2023 12:58
quick and dirty quick sort in python
import random
def quick_sort(arr):
if len(arr) <= 1:
return arr
pivot = arr[-1]
pivot_index = len(arr) - 1
@paulfrische
paulfrische / vert.glsl
Created September 26, 2023 13:44
raymarching in shadertoy
vec4 SPHERE = vec4(0.0, 0.0, 3.0, 1.0);
float FOV = 3.0;
const int MAX_STEPS = 1000;
float EPSILON = 0.01;
float GROUND = -1.0;
vec4 SPHEREC = vec4(1.0, 0.0, 0.0, 0.0);
vec4 GROUNDC = vec4(0.4);
vec4 SKYC = vec4(0.3, 0.4, 0.8, 1.0);
@paulfrische
paulfrische / vimModeStateDiagram.svg
Created September 28, 2023 15:16 — forked from darcyparker/vimModeStateDiagram.svg
Vim Modes Transition Diagram in SVG https://rawgithub.com/darcyparker/1886716/raw/eab57dfe784f016085251771d65a75a471ca22d4/vimModeStateDiagram.svg Note, most of the nodes in this graph have clickable hyperlinks to documentation.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
typedef struct Pair {
struct Pair *next;
const char *key;
void *value;
#include <iostream>
struct S {
explicit S() { std::cout << "S()\n"; } // basic constructor
S(const S& other) { std::cout << "S(const S&)\n"; } // copy constructor
S(const S&& other) { std::cout << "S(const S&&)\n"; } // move constructor
S& operator=(const S& other) { std::cout << "S& operator=(const S&)\n"; return *this; } // copy assignment operator