Skip to content

Instantly share code, notes, and snippets.

View xtotdam's full-sized avatar

Xtotdam xtotdam

  • Moscow State University, Faculty of Physics
  • Russia, Moscow
View GitHub Profile
// ==UserScript==
// @name 9gag volume and controls
// @namespace https://greasyfork.org/en/scripts/382093
// @match https://9gag.com/*
// @run-at document-start
// @grant none
// @version 1.1
// @description Adds the controls to the videos ("gifs") and sets the default volume to 30%
// @author Artain
// @author xtotdam
\documentclass[svgnames,x11names,tikz]{standalone}
\usepackage{xcolor}
\usetikzlibrary{calc,positioning,matrix,math}
\tikzset{
nosep/.style={inner sep=0,outer sep=0}
}
\usetikzlibrary{decorations.pathreplacing}
\tikzset{%
import codecs
import datetime
import eyed3
import json
from math import log
import os
import shutil
import sys
unit_list = zip(['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'], [0, 0, 1, 2, 2, 2])
--extract-audio
--prefer-ffmpeg
--audio-format mp3
--audio-quality 4
### VBR: between 0 (better) and 9 (worse)
--restrict-filenames
--output "C:\\Users\\Root\\Downloads\\youtube-dl\\%(title)s!%(id)s.%(ext)s"
// counting lengths of chains
int *lengths = (int *)calloc(N, sizeof(int));
int *zeros = (int *)calloc(N, sizeof(int));
int len, j;
for (i = 0; i < N; i++)
{
if (atoms[i] == 0)
{
zeros[cnt] = i;
@xtotdam
xtotdam / prviet.py
Last active February 26, 2017 19:34
from random import choice, random
class Annoyer():
counts_default = [1, 1]
parts = [
['bdt', 'dbt'],
['n', 'ntn', 'nbtn']
]
head = 'gh'
@xtotdam
xtotdam / merge.py
Last active May 30, 2019 03:29
Merging todo.txt Dropbox conflicted copies
#!/usr/bin/python2
import os
from pprint import pprint # pretty printer
mainfile = 'todo.txt'
archive = 'done.txt'
tag = '+auto_merged'
trashbin = 'ccs'
@xtotdam
xtotdam / 25.py
Created October 4, 2016 12:15
25th task in mail.ru quest
# -*- coding: utf8
import string
a = 'ьшоивущдйфхюжкпэнерсцталызбгячм' # исходный
# b = 'оаетинслрвукпмдьябчзыжхшц' # Донцова - плохо
b = 'оеаинтсрлвкмдыпуяьгбхзчйжшюцщэ' # Марк Твен
b = 'оеаитнрлсвкпуымугьябхчзйжшюцщэ' # iteration 1
b = 'оеаитнрлсвкпядмугьзбхчзйжшюцщэ' # iteration 2
b = 'оеаитнрлсвкпудмягызьбчшйжхюцщэф' # final
text = u'(Рьдьвьл ыжх) Й вэышдеп йшщкгшп щшаидйэ э йьющьфьыковс пьшнь кщжно. Цедь ьхьдь тшвещшз тойьф куэ, хьнко пе южйвидийс ф южвс - Дшнщоу, Бюившщ, йьцохо и э. Бюившщ ушй хьйж и дьюове; ьу уойвьэд уо чвьп уш ьв ирцевхо дбцшруьйви иди ыш ющидшыоуиэ, уь, хох э юьдоноб, ир йвщозо кьфшщивс чви ьщжкиэ йфьшпж ньйюькиуж. Фик ж ушнь цед ющшжющэпел. "Тшщвьф ыжх!" - фьв шкиуйвфшууьш, твь э жйдеаод ьв ушнь ро фйш южвшашйвфиш. Пуш юьщжтиди кфо юьволуез мьуощэ. Дшнщоу ушй ыжхо. Ыжх цед ющифэроу х хьугж аужщо, ю Дшнщоу хщжвид шнь уо зькж, хох рохдиуовшдс. Хьнко э ропшвид чвь уьфьш эфуьш кьхоровшдсйвфь цшржпиэ пьшнь кщжно, э й вщжкьп жкшщыодйэ ьв йдшр. Вшп уш пшушш э юьхо щшаид
def print_attributes(obj, v=True):
'''v = verbose'''
m = {'instancemethod':'()', 'method-wrapper':'()', 'builtin_function_or_method':'()b'}
for i in dir(obj):
t = str(type(obj.__getattribute__(i))).split('\'')[1]
if not v:
if not i.startswith('__'):
print i+m[t] if t in m.keys() else i, '\t'*(4 - (len(i)+1)/8), '' if t in m.keys() else t