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
#!/usr/bin/env bash
# Counter for connection outages
connection_outage_count=0
# Function to handle interruption by Ctrl-C
function cleanup {
echo "Script interrupted."
echo "Number of connection outages: $connection_outage_count"
exit 1
@hctilg
hctilg / secure_erase.sh
Created July 17, 2024 20:21 — 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 / stt.py
Created June 23, 2024 14:34
Sound to Text (fa-IR)
import speech_recognition as sr
from pydub import AudioSegment
audio_file = "your_audio_file_path_here.mp3"
sound = AudioSegment.from_mp3(audio_file)
sound.export("output.wav", format="wav")
recognizer = sr.Recognizer()
with sr.AudioFile("output.wav") as source:
audio_data = recognizer.record(source)
<?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)