Skip to content

Instantly share code, notes, and snippets.

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

Mahi hctilg

🌱
Studying for the entrance exam (Konkour)
View GitHub Profile
<?php
// checking the exists Library.
if (!file_exists("finglish.php")) {
copy('https://raw.githubusercontent.com/hctilg/finglish/main/index.php', 'finglish.php');
}
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
$response = [];
#include <iostream>
using namespace std;
int main() {
    string sentence, word;
    cout << "Enter a sentence: ";
    getline(cin, sentence);
    cout << "Enter a word: ";
@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 / secure_erase.sh
Created January 2, 2024 16:02 — forked from tavallaie/secure_erase.sh
**Secure Data Erasure Script (Bash)** This Bash script securely erases data from a specified device with random data, ensuring irrecoverability. Use with caution.
#!/bin/bash
# Check if the script is run with superuser privileges
if [ "$EUID" -ne 0 ]; then
echo "Please run this script as root (sudo)."
exit 1
fi
# Prompt the user for the target devices
read -p "Enter the target devices (e.g., /dev/sdX /dev/sdY): " target_devices
@hctilg
hctilg / nekoray-installer.sh
Last active May 24, 2024 11:10
Latest NekoRay Installer with shortcut in linux
#!/usr/bin/env bash
set -e
NEKORAY_URL="https://api.github.com/repos/MatsuriDayo/nekoray/releases/latest"
NEKORAY_FILE_NAME="NekoRay"
NEKORAY_DESKTOPFILE="$HOME/.local/share/applications/nekoray.desktop"
WGET_TIMEOUT="15"
# Just for fun
# Source: https://patorjk.com/software/taag/#p=display&v=1&f=ANSI%20Shadow&t=NekoRay%20Installer
@hctilg
hctilg / format-bytes.js
Created July 5, 2023 16:54
convert bytes to a human-readable string
const units = ["B", "KB", "MB", "GB", "TB", "PB"];
function formatBytes(bytes, decimals = 2) {
if (!+bytes) return "0 B";
let i = 0;
for (i; bytes >= 1024; i++) {
bytes /= 1024;
}