Skip to content

Instantly share code, notes, and snippets.

View legends2k's full-sized avatar
πŸ’­
Learning stuff at my own pace πŸ“š

Sundaram Ramaswamy legends2k

πŸ’­
Learning stuff at my own pace πŸ“š
View GitHub Profile
@legends2k
legends2k / love_object.lua
Last active March 29, 2023 19:17
Love -- Object Basics
rect = {
pos = { x = 0, y = 0},
orientation = 0.7853981634, -- 45Β° in radians (clockwise)
width = 100,
height = 100,
}
seconds_per_frame = 0
-- Called every frame; if last frame compute didn’t overshoot
-- it’d be called again in 16.667 ms i.e. 60 times in a second.
@legends2k
legends2k / sudoku_solver.rs
Last active May 12, 2020 07:23
Simple Sudoku Solver
use colored::*;
use std::fmt;
use std::io::{self, BufRead};
#[derive(Clone)]
struct Cell {
possibilities: String,
}
impl Default for Cell {
@legends2k
legends2k / minifloat.cpp
Created September 9, 2015 07:53
Prints the distribution of an 8-bit minifloat 1.4.3.βˆ’7
#include <iostream>
#include <bitset>
#include <cstdint>
#include <iomanip>
#include <limits>
#include <sstream>
#include <cmath>
/*
* 8-bit Minifloat mimicing binary32 of IEEE 754/IEC 60559
// find the next larger integer from the given number's digits
#include <iostream>
#include <cstring>
int main(int argc, char *argv[]) {
if (argc < 2) {
std::cout << "Usage: nexti <integer>\n";
return 0;
}
char *str = argv[1];
@legends2k
legends2k / dds_info.cpp
Last active August 29, 2015 14:26
Prints DDS file information
#include <fstream>
#include <iostream>
#include <array>
#include <bitset>
#include <iomanip>
#include <type_traits>
#include <stdexcept>
#include <cstdint>
using DWORD = uint32_t;