Skip to content

Instantly share code, notes, and snippets.

View aldy505's full-sized avatar
๐Ÿ…

Reinaldy Rafli aldy505

๐Ÿ…
View GitHub Profile
@aldy505
aldy505 / loki-client.ts
Last active February 2, 2025 01:32
Very simple Loki client
// This is a very simple Grafana Loki client, should be compatibla with Grafana Loki and Victoria Logs.
// Please bear in mind that because this is "very simple", this is not optimized for production use
// at all, because it doesn't send the logs in batch.
//
// MIT License
//
// Copyright (c) 2025 Reinaldy Rafli <github@reinaldyrafli.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@aldy505
aldy505 / automated-deployment-systemd.md
Last active March 3, 2025 06:08
Automated deployment with systemd on remote server

Automated deployment with systemd on remote server

For any programming language, but this time, we'll do C# (ASP.NET Core backend application). I'm using GitHub Actions with no plugins or some fancy third party dependencies whatsoever, hopefully you can adapt this into your CI runner of choice.

The GitHub Actions file and the bash script file should be easily understood.

If you don't know what a certain command does, you should Google it.

Important

I would advise you to NOT use a public IP address, and you shouldn't open your port 22 publicly.

@aldy505
aldy505 / repo-update.jl
Last active November 9, 2024 00:47
Bulk git repository updater
################################################################################
# Repo Update
#
# This script updates all the repositories in the current directory and its
# subdirectories. It checks if the current branch is merged to the remote
# branch, and if so, switches to the remote branch. If there are uncommitted
# changes, it skips switching the branch.
#
# Usage:
# repo-update.jl [directory]
@aldy505
aldy505 / code-scan.yml
Last active June 6, 2024 03:20
Code scanning defaults for Github Actions (works on public and private repository with no limits)
# Code scanning is something you would want to do to ensure the quality of your codebase.
# Usually, it'll detects security vulnerabilities, code smells, and other issues that might be present in your code.
# To learn more about code scanning, see https://snyk.io/learn/code-review/code-scanning/
name: Code Scan
on:
# Scan changed files in PRs (diff-aware scanning):
pull_request: {}
# Scan on-demand through GitHub Actions interface:
workflow_dispatch: {}
@aldy505
aldy505 / sysctl.conf
Created September 21, 2023 15:12
Linux sysctl optimization. Taken from https://klaver.it/linux/sysctl.conf
# Kernel sysctl configuration file for Linux
#
# Version 1.14 - 2019-04-05
# Michiel Klaver - IT Professional
# http://klaver.it/linux/ for the latest version - http://klaver.it/bsd/ for a BSD variant
#
# This file should be saved as /etc/sysctl.conf and can be activated using the command:
# sysctl -e -p /etc/sysctl.conf
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and sysctl.conf(5) for more details.
@aldy505
aldy505 / docker-compose.yml
Created September 10, 2023 06:43
Multi database on runtime proof-of-concept
services:
database:
image: postgres:15-alpine
ports:
- 5432:5432
environment:
POSTGRES_PASSWORD: password

Keybase proof

I hereby claim:

  • I am aldy505 on github.
  • I am aldy505 (https://keybase.io/aldy505) on keybase.
  • I have a public key whose fingerprint is 6EBA CBDC 3463 D2C9 986A 2F21 A3F8 A7E2 3DA2 AD94

To claim this, I am signing this object:

@aldy505
aldy505 / exec.sh
Created July 10, 2022 01:31
Spin up clustered rqlite on 1 host
rqlited \
-auth rqlite.json \
-fk \
-node-id 1 \
-http-addr localhost:4001 \
-raft-addr localhost:4002 \
./node.1
rqlited \
-auth rqlite.json \
@aldy505
aldy505 / browser-ts.ts
Created May 15, 2022 07:30
Proto2http generated client & server samples for router_guide.proto
/**
* Points are represented as latitude-longitude pairs in the E7 representation
* (degrees multiplied by 10**7 and rounded to the nearest integer).
* Latitudes should be in the range +/- 90 degrees and longitude should be in
* the range +/- 180 degrees (inclusive).
*/
type Point = {
latitude: number
longitude: number
}
@aldy505
aldy505 / networking_fix_wsl2.ps1
Created December 14, 2021 04:16
Dropping in here in case there's another error on networking in my WSL2
# Shutdown WSL first
wsl --shutdown --verbose
# Check it with list
wsl --list --verbose
# Open Powershell in administrator mode, then do:
New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action Allow
Get-Service LxssManager | Restart-Service