Skip to content

Instantly share code, notes, and snippets.

View muhammedfurkan's full-sized avatar
🙃

M.Furkan muhammedfurkan

🙃
View GitHub Profile
def prettyjson(obj, indent=2, maxlinelength=80):
"""Renders JSON content with indentation and line splits/concatenations to fit maxlinelength.
Only dicts, lists and basic types are supported"""
items, _ = getsubitems(obj, itemkey="", islast=True,
maxlinelength=maxlinelength - indent, indent=indent)
return indentitems(items, indent, level=0)
def getsubitems(obj, itemkey, islast, maxlinelength, indent):
@muhammedfurkan
muhammedfurkan / StreamTapeAPI.py
Last active April 30, 2022 12:08
StreamTapeAPI with python fully async
import asyncio
import hashlib
import aiohttp
from pyonize import pyonize
class StreamTapeAPI():
def __init__(self, login, key):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
if (sys.version_info < (3, 0)):
# Python 3 code in this block
print('Python v3.5 or above required for Instaloader module at the moment. Exiting...')
quit()
@muhammedfurkan
muhammedfurkan / FastTelethon.py
Created April 28, 2022 08:22 — forked from painor/FastTelethon.py
This will increase the download/upload speed when using telethon
# copied from https://github.com/tulir/mautrix-telegram/blob/master/mautrix_telegram/util/parallel_file_transfer.py
# Copyright (C) 2021 Tulir Asokan
import asyncio
import hashlib
import inspect
import logging
import math
import os
from collections import defaultdict
from typing import Optional, List, AsyncGenerator, Union, Awaitable, DefaultDict, Tuple, BinaryIO
@muhammedfurkan
muhammedfurkan / main.c
Created January 15, 2021 18:08
Write a C program that saves the name,surname,midterm grade,final grade information of 10 students entered on the keyboard into a file named "notes.txt"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define BUFFER_SIZE 500
int main()
{
// buffer to store data in buffer between writing to file
char buffer[BUFFER_SIZE];
char ch; // To store single character
int numStudents;
import logging
import aiohttp
from sample_config import Config
from userbot import bot
from userbot.util import admin_cmd
logging.basicConfig(format='[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s',
level=logging.WARNING)
logger = logging.getLogger(__name__)
@bot.on(admin_cmd(pattern="goup ?(.*)"))
async def goup(event):
await event.edit("`Progressing`")
input_str = event.pattern_match.group(1)
reply = await event.get_reply_message()
if reply:
file_name = await event.client.download_media(
reply.media,
Config.TMP_DOWNLOAD_DIRECTORY
)
@muhammedfurkan
muhammedfurkan / main.c
Created December 26, 2020 21:40
check input number is perfect number ?
#include <stdio.h>
int isperfect(int input)
{
int sum = 0, value = input / 2;
do
{
if (input % value == 0)
sum += value;
value--;
@muhammedfurkan
muhammedfurkan / main.c
Created December 26, 2020 21:38
0 ile 10000 arasındaki sayıların basamaklarını bulmak
#include <stdio.h>
#include <conio.h>
int main()
{
int a;
float birler, onlar, yuzler;
printf("3 basamakli sayi girin: ");
scanf("%d", &a);
@muhammedfurkan
muhammedfurkan / main.c
Created December 26, 2020 21:37
reverse number 0 to 99999
#include <stdio.h>
/* Iterative function to reverse digits of num*/
int reversDigits(int num)
{
int rev_num = 0;
while (num > 0)
{
rev_num = rev_num * 10 + num % 10;
num = num / 10;