Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
#include <fstream>
#include <cstdlib> // For rand() and srand()
#include <ctime> // For time()
#include <string>
#include <vector>
// Define constants for robot types
enum RobotType {
ROBOCOP,
@nickyvanurk
nickyvanurk / camera.tsx
Last active May 12, 2024 13:14
Camera perspective <-> orthographic toggle in r3f and vanilla three.js
import { useEffect, useRef, useState } from 'react';
import { useFrame, useThree } from '@react-three/fiber';
import { MapControls, OrthographicCamera, PerspectiveCamera } from '@react-three/drei';
import type { OrbitControls as OrbitControlsImpl } from 'three-stdlib';
export function Camera() {
const [oldType, setOldType] = useState('PerspectiveCamera');
const [coords, setCoords] = useState({ x: 0, y: 0 });
const gl = useThree((state) => state.gl);
@gboncoffee
gboncoffee / saguisimdasm.exs
Created May 11, 2024 23:54
Assembler de Sagui Vetorial (Sagui em Bando)
#
# Montador ridiculamente simples para Assembly de Sagui Vetorial.
# Escreve arquivos no formato hex do Logisim Evolution.
# (Informações sobre a licença abaixo)
# (Licensing information below)
#
# DÚVIDAS:
#
# - Como eu uso essa desgraça?
#
@francois-rozet
francois-rozet / flow_matching.py
Last active May 12, 2024 13:05
Flow Matching in 100 LOC
#!/usr/bin/env python
import math
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
from sklearn.datasets import make_moons
from torch import Tensor
from tqdm import tqdm
@jhrcook
jhrcook / common-github-badges.md
Last active May 12, 2024 13:05
A list of GitHub badges I usually add to me README files.

GitHub Badges

Social

jhc github jhc twitter jhc website

Code

@rasmi
rasmi / setup.md
Last active May 12, 2024 13:03
Python development environment setup on Chromebook

Python development environment setup on Chromebook

Check for updates

Do this first!

sudo apt-get update && sudo apt-get dist-upgrade

Set root password

@inorganik
inorganik / app.js
Last active May 12, 2024 13:01
Using CountUp.js in React
import { useEffect, useRef } from 'react'
// playground: https://stackblitz.com/edit/react-ts-nv5fxe?file=App.tsx
export default function App() {
// create a ref and declare an instance for each countUp animation
const countupRef = useRef(null);
let countUpAnim;
@ddh0
ddh0 / voice_chat.py
Created May 12, 2024 03:40
Make Siri speak for your LLM, using macOS `say` and easy-llama
import easy_llama as ez
from subprocess import run
USER = ez.utils.USER_STYLE
BOT = ez.utils.BOT_STYLE
DIM = ez.utils.DIM_STYLE
RESET = ez.utils.RESET_ALL
def say(something: str) -> None:
run(['say', something])
Llama3 = ez.Model(
'Meta-Llama-3-8B-Instruct-q8_0.gguf',
@ricealexander
ricealexander / emoji-list.md
Last active May 12, 2024 13:00 — forked from rxaviers/gist:7360908
Comprehensive list of GitHub-supported emojis
@MaskeZen
MaskeZen / cotizacionBCU.php
Created August 16, 2018 14:23
Cotización del BCU WS
<?php
getCotizacionesWS();
function getCotizacionesWS(){
$context = [
"ssl" => [
"verify_peer" => FALSE,
"verify_peer_name" => FALSE,
'crypto_method' => STREAM_CRYPTO_METHOD_TLS_CLIENT