Skip to content

Instantly share code, notes, and snippets.

import pygame
import numpy as np
from pygame.locals import QUIT
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
import os
# Engine class: Handles the initialization, object loading, rendering, and main game loop.
class Engine:
import pygame
import numpy as np
from pygame.locals import QUIT, KEYDOWN, KEYUP
from OpenGL.GL import *
from OpenGL.GLU import *
import os
class Engine:
def __init__(self, w, h, fov=np.pi / 4, near=0.1, far=100.0):

A metatable can be defined like

local t = setmetatable({}, {
  __tostring = function() return 'custom tostring behavior!' end
})

Here are the metamethods that you can define, and their behavior

Operators

@hlfshell
hlfshell / ultralearning.md
Created January 15, 2023 22:08
Ultralearning Notes

Ultralearning

The following is the notes I took years ago on the book Ultralearning by Scott Young. The bombastic title and promise to learn virtually anything quickly makes it sound as if its the typical marketing-powered fluff-filled nonfiction book stores are overflowing with, but something about this book stuck with me. After finishing it I quickly went back and wrote these thoughts down. While I don't follow his layout of plans regularly, I have used it to guide a lot of my own self education.

I've successfully utilized it when I needed to refresh on mathematics for my Master's degree (a host of skills that atrophied sigificantly for the dozen years between undergrad and the masters). I've also used it to self-study subjects like Robotics and Deep Learning (though I did decide in the end to go for the Master's accreditation).

I share it here with hopes that someone finds it useful.


Principle 1 - Metalearning

@customcommander
customcommander / browser_logs-chrome.js
Created May 25, 2017 09:13
Capture console.log() output from a web page with Selenium WebDriver 2.53 and Chrome
require('chromedriver');
const path = require('path');
const wd = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');
var builder = new wd.Builder();
var options = new chrome.Options();
var prefs = new wd.logging.Preferences();
var driver;
@yifanzz
yifanzz / .cursorrules
Last active January 4, 2025 23:56
EP7 Notes
You are an expert in TypeScript, Node.js, Next.js App Router, React, Shadcn UI, Radix UI and Tailwind.
Project Context: This is a dev tool built for evaluating open source projects allowing people to better understand the maintainability, activity and longevity of a given project to allow devs to better decide whether they should include or use the given open source repositories after the analysis
Code Style and Structure
- Write concise, technical TypeScript code with accurate examples.
- Use functional and declarative programming patterns; avoid classes.
- Prefer iteration and modularization over code duplication.
- Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
- Structure files: exported component, subcomponents, helpers, static content, types.
@yifanzz
yifanzz / code-editor-rules.md
Created December 17, 2024 00:01
EP12 - The One File to Rule Them All

[Project Name]

Every time you choose to apply a rule(s), explicitly state the rule(s) in the output. You can abbreviate the rule description to a single word or phrase.

Project Context

[Brief description ]

  • [more description]
  • [more description]
  • [more description]
@summivox
summivox / fanatec_shifter.ino
Last active January 4, 2025 23:53
DIY USB adapter for Fanatec ClubSport Shifter SQ v1.5 (Arduino Due)
#include <cstdint>
#include "Joystick.h"
const int16_t gate_r = 3340;
const int16_t gate_12 = 2690;
const int16_t gate_34 = 2000;
const int16_t gate_56 = 1230;
const int16_t gate_7 = 550;
@depau
depau / README.md
Last active January 4, 2025 23:52
Valetudo Gamepad Control

PyGame-based Valetudo Gamepad Remote Control

Uses PyGame, so it should work with all gamepads that work in actual games.

Nasty code ;)

It requires the gamepad to have at least one analog stick.

Modify the script and set DRY_RUN to True to avoid contacting Valetudo during gamepad testing.