Skip to content

Instantly share code, notes, and snippets.

View noahjames404's full-sized avatar
🏠
Working from home

noah james noahjames404

🏠
Working from home
View GitHub Profile
@noahjames404
noahjames404 / index.js
Created May 14, 2025 08:46
socket io simplified server
const { Server } = require("socket.io");
const io = new Server({ /* options */ });
io.on("connection", (socket) => {
console.log(`user connected:`,socket.id);
socket.on("msg",(arg1) => {
console.log(arg1);
@noahjames404
noahjames404 / airflow.yml
Created May 3, 2025 04:26
docker compose
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@noahjames404
noahjames404 / GetCenterBounds.cs
Created April 16, 2025 02:21
Centralize the game object pivot in unity
using Sirenix.OdinInspector;
using UnityEngine;
namespace maphatar.civsim
{
public class GetCenterBounds : MonoBehaviour
{
[SerializeField, ReadOnly]
Vector3 center;
@noahjames404
noahjames404 / stat.cs
Created April 4, 2025 14:41
Unity stat/attribute
using UnityEngine;
namespace kokomeron
{
[System.Serializable]
public class Stat
{
[SerializeField]
private float baseValue;
[SerializeField]
@noahjames404
noahjames404 / .htaccess
Created March 31, 2025 06:23
Laravel Rewrite Rule to public folder. Paste this on the root of the project.
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$ /public/$1 [L,QSA]
@noahjames404
noahjames404 / helloflask.py
Created March 26, 2025 09:14
api demo in flask environment
from flask import Flask, request
app = Flask(__name__)
@app.route("/")
def hello_world():
searchword = request.args.get('key', '')
return {
"searchword": searchword,
sudo dnf install -y git --skip-broken
cd ~/.ssh
ssh-keygen -t rsa -b 4096 -N "" -f ~/.ssh/id_rsa && cat id_rsa.pub
@noahjames404
noahjames404 / linux-setup.sh
Last active March 24, 2025 19:13
vps linux quick setup
#amazon-linux reference - https://docs.aws.amazon.com/linux/al2023/release-notes/all-packages-AL2023.6.html
sudo dnf update
#installation
sudo dnf install -y vim curl unzip nginx certbot python3-certbot-nginx postgresql16.x86_64 postgresql16-server nodejs git --skip-broken
#nginx
sudo systemctl enable nginx && sudo systemctl start nginx && systemctl status nginx
ln -s /etc/nginx nginx
@noahjames404
noahjames404 / strapi-upload-plugin-middleware
Created February 27, 2025 02:06
Strapi Upload Plugin Middleware, change format of avif file to webp to support multiple file formats
/**
* `upload-plugin` middleware
*/
import * as fs from 'fs';
import type { Core } from '@strapi/strapi';
import sharp from 'sharp';
import formidable, { PersistentFile } from 'formidable';
import path from 'path';
import { Context } from 'koa'
@noahjames404
noahjames404 / postgres-docker.yml
Created February 14, 2025 11:33
postgres docker compose
version: '3.8'
services:
db:
image: postgres:17
restart: always
shm_size: 128mb
container_name: postgres_db
environment:
POSTGRES_USERNAME: user