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 / 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
@hctilg
hctilg / copy.js
Created October 8, 2024 20:23
Copy to clipboard with Javascript
function copyToClipboard(text, success) {
if (navigator.clipboard && window.isSecureContext) {
return navigator.clipboard.writeText(text).then(success).catch(err => {
console.error('Failed to copy text: ', err);
});
} else {
const textarea = document.createElement('textarea');
textarea.value = text;
document.body.appendChild(textarea);
@hctilg
hctilg / index.php
Created September 15, 2024 08:59
Get audio tags in PHP
<?php
require_once './getid3/getid3.php';
/**
* @param string $audio URL or local Path
* @return array
*/
function get_audio_tags($audio) {
// Initialize getID3 engine
from bs4 import BeautifulSoup
from requests import get
class github():
def __init__(self, user):
self.user = user
def following(self):
return self.get_users("following")
@hctilg
hctilg / README.md
Created August 14, 2024 17:43
Send HTTP requests easily using JavaScript

requests.js

Send HTTP requests easily using JavaScript

import RequestsJs using this script link

<script src="requests.js" async></script>

Example

@hctilg
hctilg / range.js
Created July 31, 2024 03:30
Sequence generator function
// Sequence generator function
const range = (start = 0, stop = 0, step = 0) => Array.from({ length: (stop - start) / step + 1 }, (_, i) => start + (i * step));
@hctilg
hctilg / colors.sh
Created July 31, 2024 03:29
Colors & ClearScreen Ascii code in bash Script
#!/usr/bin/env bash
clear_screen () { echo -en '\033[2J\033[u' }
# Reset
Color_rst='\033[0m' # Text Reset
# Regular Colors
Black='\033[0;30m' # Black
Red='\033[0;31m' # Red