Skip to content

Instantly share code, notes, and snippets.

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

Mahoor Nemati ✨ hctilg

🥀
Depression and Studying for the entrance exam (Konkour)
View GitHub Profile
@hctilg
hctilg / install-alpine.md
Last active September 8, 2025 11:26
My Experience and Challenges Installing Alpine Linux

آموزش نصب Alpine Linux به زبان فارسی (غیرتخخصی-عامیانه)

این صرفا آموزش نصب و راه اندازی هستش و من قرار نیست هیچ موردی رو بیش از حد نیاز براتون توضیح بدم، صرفا میگم چجوری باید نصبش کنید.

خب اول از همه شما میری توی این آدرس از وبسایت Alpine Linux و نسخه مناسب سیستم خودتون رو دانلود کنید اگه رو لینوکس یا مک هستید میتونید با کامند uname -m ببینید کدوم مورد مناسبتونه، اگه رو ویندوز هستید هم من نمیدونم (هیچوقت ویندوز نداشتم).

بعدش نیاز به یه مموری دارید تا بوتیبلش کنید، اگه رو ویندوز هستید از یه نرم افزاری مثل Rufus استفاده کنید، اگر روی مک هستید با کامند diskutil list و اگه روی لینوکس هستید با کامند lsblk اسم دیوایس مموریتون رو پیدا کنید و بعد هم با کامند زیر اون رو بوتیبل کنید:

sudo dd if=./alpine.iso of=/dev/sdb bs=4M status=progress oflag=sync
<?php
/*
* Source https://github.com/SafaSafari/freeproxylists
*/
function get($proxy = null, $page = 1) {
$ch = curl_init('http://www.freeproxylists.net/' . ($page > 1 ? '?page=' . $page : null));
$options[CURLOPT_FOLLOWLOCATION] = true;
$options[CURLOPT_RETURNTRANSFER] = true;
@hctilg
hctilg / translate_srt.php
Created July 24, 2025 06:57
Subtitle (srt files) translation with PHP
<?php
function translate($text, $source_lang = 'en', $target_lang = 'fa') {
$url = 'https://translate.googleapis.com/translate_a/single?';
$url .= http_build_query([
'client' => 'gtx',
'sl' => $source_lang,
'tl' => $target_lang,
'dt' => 't',
'q' => $text,
@hctilg
hctilg / redirectcheck.php
Created July 18, 2025 10:26
Check your URL redirect for accuracy.
<?php
// Check if cURL is installed
if (!function_exists('curl_init')) {
die("<h2>Error:</h2><p>PHP cURL extension is not enabled. Please enable it to use this script.</p>");
}
function validateUrl($url) {
return filter_var($url, FILTER_VALIDATE_URL);
}
@hctilg
hctilg / ping.php
Created July 16, 2025 15:22
How can I ping a server port with PHP?
<?php
function ping($ip, $port = 80, $timeout = 1) {
try {
$output = [];
$result = null;
exec("ping -c 4 " . escapeshellarg($ip), $output, $result);
if ($result === 0) {
@hctilg
hctilg / whitenoise.sh
Created May 20, 2025 10:23
Play whitenoise on Linux
#!/usr/bin/env bash
# Requirement: sox
# For Example : `sudo pacman -S sox`
while true; do
play -n synth 3600 whitenoise
done
@hctilg
hctilg / index.php
Created February 25, 2025 15:07
GitHub Checker
<?php
class GitHub {
public $username;
public function __construct(string $username) {
// Check username
if (empty($username))
die("Username should not be empty!\n");

Fibonacci Sequence Generator

This Python script generates the Fibonacci sequence up to a specified maximum number of terms. The Fibonacci sequence is a series of numbers where each number is the sum of the two preceding ones, usually starting with 0 and 1.

How It Works

The script defines a generator function fibonacci(n) that yields the Fibonacci numbers up to n. The main part of the script prompts the user to input the maximum number of terms they want to generate and then prints each term of the Fibonacci sequence.

Code

import os
import re
images = [img for img in os.listdir(folder_path) if img.endswith(('.png', '.jpg', '.jpeg'))]
images.sort(key=lambda filename: [int(text) if text.isdigit() else text for text in re.split('([0-9]+)', filename)])
print(images)
"The number of segments cannot exceed the length of the list!"
def split_list(lst, n):
if n <= 0: return []
elif n > len(lst):
return "The number of segments cannot be greater than the length of the list!"
else:
avg = len(lst) / n
out = []
last = 0.0