from telethon import TelegramClient, sync
from telethon.tl.functions.channels import GetParticipantsRequest
from telethon.tl.functions.messages import GetHistoryRequest
from PIL import Image
from wordcloud import WordCloud, STOPWORDS
import matplotlib.pyplot as plt
import numpy as np
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 sys,os | |
import curses | |
def draw_menu(stdscr): | |
k = 0 | |
cursor_x = 0 | |
cursor_y = 0 | |
# Clear and refresh the screen for a blank canvas | |
stdscr.clear() |
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
Python 19 hrs 6 mins █████████████████▏░░░ 82.0% | |
JavaScript 1 hr 55 mins █▋░░░░░░░░░░░░░░░░░░░ 8.2% | |
Other 1 hr ▉░░░░░░░░░░░░░░░░░░░░ 4.3% | |
JSX 50 mins ▊░░░░░░░░░░░░░░░░░░░░ 3.6% | |
YAML 20 mins ▎░░░░░░░░░░░░░░░░░░░░ 1.5% |
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
class Func { | |
static loop(cnt, func) { | |
'v' | |
.repeat(cnt) | |
.split('') | |
.map((_, idx) => func(idx)); | |
} | |
} |
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
const https = require("https"); | |
const token = ""; // change this to you telegram bot token! | |
const chatId = ""; // change this to your telegram chat id! | |
const cookie = ""; // change this to your shanbay cookie! | |
const PATH_API = (page) => | |
`/wordsapp/user_material_books/blozps/learning/words/today_learning_items?ipp=10&page=${page}&type_of=NEW`; | |
const options = { |
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
{ | |
"since_id": [ | |
"1400315510017773570", | |
"1400310811004870664", | |
"1400310789886464000", | |
"1400301511956045825", | |
"1400276115483107328", | |
"1400275292397076486", | |
"1400253696026431488", | |
"1400253351976075264", |
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 requests | |
API = "https://api.wmdb.tv/api/v1/top?type={movie_type}&skip=0&limit={limit}" | |
def get_top_movies(movie_type, limit=250): | |
r = requests.get(API.format(movie_type=movie_type, limit=limit)) | |
if not r.ok: | |
raise Exception(f"Can not get movies for {movie_type} type") | |
return r.json() |
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
// ============================================================================= | |
// XNU kperf/kpc demo | |
// Available for Intel/Apple M1, macOS/iOS, with root privileges | |
// | |
// XNU source (since xnu 2422.1.72): | |
// https://github.com/apple/darwin-xnu/blob/main/osfmk/kern/kpc.h | |
// https://github.com/apple/darwin-xnu/blob/main/bsd/kern/kern_kpc.c | |
// | |
// System Private frameworks (since macOS 10.11, iOS 8.0): | |
// /System/Library/PrivateFrameworks/kperf.framework |
Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.
There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.
1. Combined type and variable/field declaration, inside a struct scope [https://godbolt.org/g/Rh94Go]
struct foo {
struct bar {
int x;
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
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
OlderNewer