Skip to content

Instantly share code, notes, and snippets.

View fivemoreminix's full-sized avatar

Luke Wilson fivemoreminix

View GitHub Profile
@fivemoreminix
fivemoreminix / port_scanner.rs
Created February 27, 2018 02:36
Over-engineered job-stealing multithreaded port scanner in Rust.
extern crate rayon;
use std::io::{stdout, Write};
use std::net::{IpAddr, Ipv4Addr, TcpStream};
use rayon::prelude::*;
static MAX_PORT: u16 = 65535;
fn main() {
let address = IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1));
@fivemoreminix
fivemoreminix / main.rs
Last active January 14, 2021 16:43
Simple Brainfuck to C compiler written in Rust.
// "Hello, world!"
static PROGRAM: &'static str = "++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.";
fn main() {
let tokens = tokenize(PROGRAM);
//println!("{:?}", tokens);
let generated_code = generate(&tokens);
println!("{}", generated_code);
}
@fivemoreminix
fivemoreminix / hw.ox
Created March 24, 2018 06:14
A test for a language im designing.
<!-- Preprocessor -->
<!--
In this form, the preprocessor presented is LaTeX code,
that is specific to the LaTeX backend only.
Every backend will have to have its own implementation for preprocessor.
The preprocessor can be used for things like scripting environment variables, page numbers, and more.
-->
@title Hello World
@fivemoreminix
fivemoreminix / brainfuck.odin
Created March 29, 2018 23:04
Brainfuck interpreter written in Odin.
import "core:fmt.odin"
interpret :: proc(program: string) {
tape: [30000]u8 = 0;
ptr := 0;
index := 0;
for index < len(program) {
switch program[index] {
@fivemoreminix
fivemoreminix / ascii_table.rs
Created April 17, 2018 22:35
Tiny Rust ASCII table printer
fn main() {
println!("| {:^5} | {:>3} | {:>4} | {:03} |", "Char", "Dec", "Hex", "Oct");
println!("|-------|-----|------|-----|");
for c in 0u8..128u8 {
println!("| {:^5} | {:>3} | {:>#4X} | {:03o} |", get_char_name(c), c, c, c);
}
}
fn get_char_name(c: u8) -> String {
assert!(c < 128);
@fivemoreminix
fivemoreminix / Camera.gd
Last active June 2, 2018 03:11
3D Godot GDScript camera shake script.
extends Camera
func shake(length, magnitude):
var time = 0
var camera_pos = translation
while time < length:
time += get_process_delta_time()
var offset = Vector3()
offset.x = rand_range(-magnitude, magnitude)
@fivemoreminix
fivemoreminix / renderer.go
Last active June 28, 2018 18:50
A (currently) incomplete 3d terminal renderer.
package main
import (
"github.com/nsf/termbox-go"
)
func DrawPoint(x, y int, color termbox.Attribute) {
termbox.SetCell(x, y, ' ', termbox.ColorDefault, color)
}
This is a conversation between ok and yourself, aesl.
ok: WAT
aesl: minimal
aesl: I like it
aesl: whatcha doin "ok"
ok: did you just assume what i am doing?
ok: please don't do that
ok: >:(
aesl: sorryyyy
aesl: i did not mean to offend you
@fivemoreminix
fivemoreminix / exclamation.c
Created July 30, 2018 17:20
The same algorithm written in three different systems programming languages. You can use this to test compiler speeds, performances, generated assembly, or just for seeing the syntactical differences between the programs. Did this for fun, its not much really.
// This was actually the first implementation I wrote. I made
// this and decided I should try writing the same algorithm in
// Zig for learning the language. After I was done I found it
// interesting the differences in how they accomplish the same
// thing. I thought it'd be neat to write this algorithm in more
// languages just for science.
//
// The algorithm is very simple. Essentially you give it a string
// and it replaces every vowel with exclamation marks and returns
// the new one.
@fivemoreminix
fivemoreminix / chat.txt
Created August 5, 2018 17:37
I talk about C++ or C# for Unity to someone who doesn't know what C# is.
RifToday at 12:21 PM
Hi, about that message I sent yesterday in the coding server, I know basics and some functions in c++, but I don't know how to use it on Unity and which functions are more useful, currently I wanted to learn how to structure an RPG and some tips on how to make a bullet hell work.
aeslToday at 12:24 PM
Okay, well I can give you a quit direction to follow. You will probably have trouble using C++ as your language in unity since it may not have bindings (look up "Unity C++ bindings"), so C# may be a good option instead. In order to even get your C++ code to be executed by your C# code (you have to probably call your C++ from a tiny C# script), your C++ must be compiled to a dynamic library most likely (a .dll file on windows) or possibly, if you're lucky, a static library (or .lib on windows)
That's the quick guide on how to do that
but I've never used C++ with Unity before, I know for a fact that it is possible. just either it will be tricky or easy
RifToday at 12:25 PM
What are the differe