Skip to content

Instantly share code, notes, and snippets.

View lukewilson2002's full-sized avatar

Luke Wilson lukewilson2002

View GitHub Profile
@lukewilson2002
lukewilson2002 / unfilled_circle.gd
Last active April 24, 2019 02:57
Unfilled cicle script for GDScript
func draw_unfilled_circle(circle_center: Vector2, radius: float, color: Color, width = 1, resolution: float = 1):
var draw_counter = 1.0
var vec_radius = Vector2(radius, 0)
var line_origin = vec_radius + circle_center
var line_end = Vector2()
while draw_counter <= 360.0:
line_end = vec_radius.rotated(deg2rad(draw_counter)) + circle_center
draw_line(line_origin, line_end, color, width)
draw_counter += 1.0 / resolution
@lukewilson2002
lukewilson2002 / cpp_in_rust.rs
Created November 25, 2018 18:14
Created by repnop and Violetas The Crusader in the Rust Programming Language Discord server for satirical purposes.
#[allow(bad_style)]
struct cout;
impl<T: std::fmt::Display> std::ops::Shl<T> for cout {
type Output = cout;
fn shl(self, rhs: T) -> cout {
print!("{}", rhs);
cout
}
@lukewilson2002
lukewilson2002 / cmd.bat
Created November 16, 2018 15:48
How to beat my system administrators...
@echo off
title cmd
:proc
SET /P name=>
%name%
goto :proc
@lukewilson2002
lukewilson2002 / main.rs
Created October 28, 2018 18:01
Beginning of a keylogger for Windows written in Rust.
[package]
name = "keylog"
version = "0.1.0"
edition = "2018"
[dependencies]
winapi = { version = "0.3", features = ["std", "windef", "winuser"] }
kernel32-sys = "0.2.2"
user32-sys = "0.2.0"
expression = additive_expr ;
additive_expr = multiplicative_expr, { ("+" | "-"), additive_expr } ;
multiplicative_expr = factor, { ("*" | "/"), multiplicative_expr } ;
factor = "(", additive_expr, ")"
| number ;
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
enum Token
{
LEFT, RIGHT,
PLUS, MINUS,
READ, WRITE,
LLOOP, RLOOP,
@lukewilson2002
lukewilson2002 / 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
@lukewilson2002
lukewilson2002 / 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.
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
@lukewilson2002
lukewilson2002 / 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)
}