Skip to content

Instantly share code, notes, and snippets.

View erikandri's full-sized avatar
🎯
Focusing

Erik Andri Budiman erikandri

🎯
Focusing
View GitHub Profile
@erikandri
erikandri / internet_time_provider.py
Created December 10, 2025 03:21
Internet Time Provider
import platform
import random
import re
import socket
import ssl
import struct
import subprocess
import threading
import time
from concurrent.futures import ThreadPoolExecutor, as_completed
@erikandri
erikandri / Dockerfile-laravel
Created May 8, 2024 06:46
Dockerfile for Laravel with Apache
FROM php:8.3.6-apache
# Install all the system dependencies and enable PHP modules
RUN apt-get update && apt-get install -qq -y \
libicu-dev \
libpq-dev \
libmcrypt-dev \
supervisor \
git \
cron \
@erikandri
erikandri / verify_password_rules.go
Created November 6, 2023 02:25
Verify Password Rules for Go
package main
import (
"unicode"
"regexp"
"fmt"
)
func verifyPasswordRules(password string, minLength int, requireCapital bool, requireNumber bool, requireSpecial bool, minCapital int, minNumber int, minSpecial int) bool {
passwordLength := len(password)
@erikandri
erikandri / verify_password_rules.php
Created November 6, 2023 02:21
Verify Password Rules for PHP
function verifyPasswordRules($password, $minLength, $requireCapital, $minCapital, $requireNumber, $minNumber, $requireSpecial, $minSpecial) {
$passwordLength = strlen($password);
$capitalCount = preg_match_all('/[A-Z]/', $password);
$numberCount = preg_match_all('/[0-9]/', $password);
$specialCount = preg_match_all('/[^A-Za-z0-9]/', $password);
// Check minimum length rule
if ($passwordLength < $minLength) {
return false;
}
@erikandri
erikandri / hexify.py
Last active October 9, 2023 07:18
A Simple Python Hexifier to Protect Strings Inside Snippet
import argparse
import ast
import os.path
import re
import sys
class Hexify:
@staticmethod
def hexify_strings(source: str) -> str:
@erikandri
erikandri / Dockerfile-systemctl
Created August 23, 2023 04:13
Docker Image with systemctl support (Ubuntu/Debian)
# Use a base image with systemd support, you free to modify the base image as you want
FROM ubuntu:23.10
#FROM debian:12
# Enable systemd
ENV container docker
STOPSIGNAL SIGRTMIN+3
# Install systemd and other dependencies
RUN apt-get update && \
@erikandri
erikandri / cython_setup.py
Last active August 14, 2023 04:46
Python setup to compile your Python file into C++ using Cython with a custom setup to organize the result path
import os.path
import shutil
from distutils.command.build_ext import build_ext
from distutils.extension import Extension
from Cython.Build import cythonize
from distutils.core import setup
class CustomBuildExt(build_ext):
@erikandri
erikandri / minify.py
Last active October 9, 2023 09:44
A Simple Python Minifier
import argparse
import ast
import os.path
import re
import sys
class Modification:
@staticmethod
def remove_docstring(source: str):
@erikandri
erikandri / printer.py
Created June 18, 2023 05:58
Python printer
class Printer:
def __init__(self, is_verbose: bool = False):
self.is_verbose = is_verbose
def verbose(self, message: str):
if self.is_verbose:
print(f"[v] {message}")
@staticmethod
def basic(message: str):
@erikandri
erikandri / get_users.py
Created June 14, 2023 05:48
Retrieve Computer Users
import psutil
def get_users_information() -> list[dict[str, str]]:
"""
The get_users_information function returns a list of dictionaries containing information about the users currently logged into the system.
Returns:
A list of dictionaries