Skip to content

Instantly share code, notes, and snippets.

import asyncio
from telethon import TelegramClient, events
from yandex_music import Client
import time
import datetime
yaclient = Client.from_credentials('fryday.kg@yandex.ru', 'xxxxx')
def get_current_track():
try:
<!DOCTYPE html>
<html>
<head>
<title>Hello</title>
</head>
<body>
<script type="text/javascript">
window.RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection; //compatibility for firefox and chrome
var pc = new RTCPeerConnection({iceServers:[]}), noop = function(){};
pc.createDataChannel(""); //create a bogus data channel
# Echo client program
import socket
import math
import numexpr
x = ['+','-','/', '*']
e = 0.00001
@frydaykg
frydaykg / mybook.py
Created April 14, 2018 20:33
DOwnload books from mybook.ru
import requests
from itertools import product
import time
import re
import os
import subprocess
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
fryday@fryday-HP-ZBook-15:~/sorts$ time ./quick_sort_lamuto 5000000 1234
OK
real 0m39.338s
user 0m39.365s
sys 0m0.000s
fryday@fryday-HP-ZBook-15:~/sorts$ time ./quick_sort_lamuto_modified 5000000 1234
OK
int Partition(int *a, int l, int r) {
int x = a[l], i = l - 1, j = r;
while (1) {
do j--; while (a[j] > x);
do i++; while (a[i] < x);
if (i < j)
swap(a[i],a[j]);
else
return j + 1;
}
@frydaykg
frydaykg / gist:d17444463e4427ab882a
Created March 14, 2015 23:14
Lamuto partition improved
int Partition(int *a, int l, int r) {
r--;
int pivot = a[r];
int i = l - 1;
for (int j = l; j < r; j++)
if (a[j] <= pivot)
if (++i != j)
swap(a[i], a[j]);
swap(a[++i], a[r]);
return i;
int Partition(int *a, int l, int r) {
r--;
int pivot = a[r];
int i = l - 1;
for (int j = l; j < r; j++)
if (a[j] <= pivot)
swap(a[++i], a[j]);
swap(a[++i], a[r]);
return i;
}
#include "sort.h"
#include "utils.h"
int Partition(int *a, int l, int r);
void Sort(int *a, int l, int r) {
if (r - l > 1) {
int m = Partition(a, l, r);
Sort(a, l, m);
Sort(a, m + 1, r);
@frydaykg
frydaykg / gist:36e79172ad419b19bd59
Created February 19, 2015 21:32
cs cart unsubscribe key generation
$_data = array(
'subscriber_id' => $subscriber_id,
'list_id' => $list_id,
'activation_key' => md5(uniqid(rand())),
'unsubscribe_key' => md5(uniqid(rand())),
'email' => $subscriber['email'],
'timestamp' => TIME,
'lang_code' => $lang_code,
'confirmed' => ($_confirmed == NULL) ? (!empty($lists[$list_id]['register_autoresponder']) ? 0 : 1) : ($_confirmed ? 1 : 0),
'format' => intval($format)