Skip to content

Instantly share code, notes, and snippets.

@lamarmarshall
lamarmarshall / DashState.cs
Created March 23, 2024 23:42
godot 4, C#, transition states
using Godot;
using System;
public partial class DashState : Node
{
Player characterNode;
public override void _Ready()
{
base._Ready();
characterNode = GetOwner<Player>();
@lamarmarshall
lamarmarshall / IdleState.cs
Created March 22, 2024 13:17
godot 4, C#, state machine
using Godot;
using System;
public partial class IdleState : Node
{
public override void _Ready()
{
base._Ready();
}
@lamarmarshall
lamarmarshall / Player.cs
Created March 22, 2024 02:03
godot 4, c#, querying nodes, attributes
using Godot;
using System;
using System.Reflection;
public partial class Player : CharacterBody3D
{
[Export] private AnimationPlayer animationPlayerNode;
[Export] private Sprite3D sprite3DNode;
private Vector2 direction = Vector2.Zero;
@lamarmarshall
lamarmarshall / Player.cs
Created March 22, 2024 00:29
godot 4, c#, 2.5d player movement
using Godot;
using System;
using System.Reflection;
public partial class Player : CharacterBody3D
{
private Vector2 direction = Vector2.Zero;
private float Speed = 10;
public override void _PhysicsProcess(double delta)
{
@lamarmarshall
lamarmarshall / Platform.gd
Created January 22, 2024 03:20
godot 4, player movement hop
extends Area2D
func _on_body_entered(body: Node2D) -> void:
if body is Player:
if body.velocity.y > 0:
body.jump()
@lamarmarshall
lamarmarshall / Cargo.toml
Created January 11, 2024 02:42
rust, yew, components, main
[package]
name = "yew-test"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
yew = { version = "0.20", features = ["csr"] }
web-sys = {version = "0.3", features = ["HtmlInputElement"]} # go between for web apis
@lamarmarshall
lamarmarshall / long_hours.rs
Created January 11, 2024 00:09
rust, compute longest hours for employee
use std::convert::TryInto;
use std::collections::HashSet;
use std::convert::TryInto;
fn longest_buzy_time(working_slots: Vec<Vec<u8>>) -> u8 {
let mut employee_longest_nonstop_work: Vec<u8> = Vec::new();
for i in working_slots {
employee_longest_nonstop_work.push(longest_period(i));
}
for i in 0..employee_longest_nonstop_work.len(){
@lamarmarshall
lamarmarshall / line.sh
Created January 10, 2024 23:17
bash, awk, display between line numbers
head -20 first.sh | tail -5
or
awk 'NR>=9 && NR <=14 {print}' first.sh
or
sed -n '8,13p' first.sh
@lamarmarshall
lamarmarshall / main.py
Created January 9, 2024 05:39
python, flutter, flet
# run -> poetry run flet app.py
import flet as ft
def main(page: ft.Page):
page.window_width = 500
page.window_height = 900
page.bgcolor = ft.colors.PURPLE
page.title = "My first Page"
text_field = ft.TextField(color=ft.colors.PURPLE, label="todo",width=350, height=100, bgcolor=ft.colors.PURPLE_100,
border_radius=10, border_color=ft.colors.PURPLE_200, border_width=2)
@lamarmarshall
lamarmarshall / llama2.py
Created January 8, 2024 05:11
python, aws, bedrock, llama2 model
import boto3
import json
bedrock_runtime = boto3.client(region_name='us-east-1', service_name="bedrock-runtime")
prompt = "What are some unique cultural things about romanians"
body = json.dumps({"prompt": prompt,
"temperature": 0.9,
"top_p": 1,
"max_gen_len": 1024})