Skip to content

Instantly share code, notes, and snippets.

View hctilg's full-sized avatar
🥲
Depression and Studying for the entrance exam (Konkour)

Mahi ✨ hctilg

🥲
Depression and Studying for the entrance exam (Konkour)
View GitHub Profile
@hctilg
hctilg / redirect.php
Created April 1, 2024 08:08
redirect
<?php
function redirect($url) {
if (!headers_sent()) {
header("Location: $url");
} else {
echo "<script type='text/javascript'>window.location.href='$url'</script>";
echo "<noscript><meta http-equiv='refresh' content='0;url=$url'/></noscript>";
}
}
@hctilg
hctilg / matrix.bat
Created March 29, 2024 07:39
Matrix with batch-script
@echo off
title "Matrix"
setlocal enabledelayedexpansion
for /f "tokens=2 delims=[]" %%a in ('ver') do for /f "tokens=2 delims=. " %%a in ("%%a") do set /a "FullScreen=-((%%a-6)>>31)"
if "%1"=="" (
for %%a in (FontSize:00080008 FontFamily:00000030 WindowSize:00320050 ScreenColors:0000000a CodePage:000001b5 ScreenBufferSize:00320050 FullScreen:!FullScreen!
) do for /f "tokens=1,2 delims=:" %%b in ("%%a") do (
>nul reg add HKCU\Console\TheMatrix /v %%b /t reg_dword /d 0x%%c /f
)
from time import time
milliseconds = round(time() * (10 ** 3))
rand = lambda _seed, _min, _max: (_seed % (_max - _min + 1)) + _min
random = rand(milliseconds, 0, 100)
print(random)
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
def view(user, _view):
  print('-' * (len(user) + 8))
  view_count = 0
  options = Options()
  options.add_argument("--headless")
@hctilg
hctilg / bin_dump.sh
Last active February 3, 2024 06:24
binary to ascii
#!/usr/bin/env bash
if [ -t 0 ]; then
read -p "b: " binary_text
else
binary_text=$(cat -)
fi
binary_array=($binary_text)
@hctilg
hctilg / format-bytes.js
Last active June 15, 2024 21:10
convert bytes to a human-readable string
function formatBytes(bytes, decimals = 2) {
if (Number.isNaN(bytes)) return "Incalculable";
if (!+bytes) return "0 B";
let i = 0;
for (i; bytes >= 1024; i++) bytes /= 1024;
const dm = bytes % 1 === 0 ? 0 : decimals;
const units = ["B", "KB", "MB", "GB", "TB", "PB"];