This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import hashlib | |
import aiohttp | |
from pyonize import pyonize | |
class StreamTapeAPI(): | |
def __init__(self, login, key): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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 | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int isperfect(int input) | |
{ | |
int sum = 0, value = input / 2; | |
do | |
{ | |
if (input % value == 0) | |
sum += value; | |
value--; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <conio.h> | |
int main() | |
{ | |
int a; | |
float birler, onlar, yuzler; | |
printf("3 basamakli sayi girin: "); | |
scanf("%d", &a); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |