Skip to content

Instantly share code, notes, and snippets.

View paulll's full-sized avatar

Panov Paul paulll

  • Russia, Saint-Petersburg
  • 15:46 (UTC +03:00)
View GitHub Profile
@paulll
paulll / gist:56bc532ad3c600ece368
Last active August 29, 2015 14:13
Five-line caesar cipher solver
for (var i=-50; i<50; i++) {
console.log ("String to decode".split('').map(function(e){
return String.fromCharCode(e.charCodeAt(0) + i);
}).join(''));
}
@paulll
paulll / fix.js
Created June 28, 2015 17:37
Fix github logo
document.querySelector('body>div.wrapper>div.header.header-logged-in.true>div>a>img').src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAA1VBMVEX///8XFRX+/f0ZFxcSEBD8/PwbGRkVExMPDQ0LCQkGAwMJBwf6+voDAQEnJSX19fUxMDD39/fFxcWamppOTU1EQ0NBPz82NDQpJycfHR3w8PDn5+fQ0NBYVlY9PDwjIiLd3d3T09OJiIiAfn51dHRdXFw6ODjy8vLu7u7t7e3p6enY19e4t7e0s7Ourq6enZ2Pjo6FhIRpaGhkY2NKSUlHRUUuLCzv7+/g4ODJyMisq6uop6ekpKR5d3dtbGzk5OTh4eHMy8u/vr6+vr6VlZWVlJR3d3ck4++hAAACIElEQVQ4y2VTiZKiQAwNdtMXoKiAMt634+14zD177/9/0r5WqMUyRVVX+r3OS0JCmbklqv4aRWGvFx4/VxUq4eK/waX5rsE9xaXkSqtwv8CTAl6ij3KgHMYcGGNMBWm9hNscp8rBcGHR3IQMOnMAGT6PAyGcG2PCTFtXBrI7GcGVIwqwo7jwps8ALeEJeDmRBhTJucTh8W6TC9OxBJfePCHMb1qOpeFps5lyw7/a9O5BpQ6YZmeOtGvk0496u/Xw0Bpsa7gfSIfx3gISdQNx3iYf5Nxcn/oMWmaIFBLNHOZt8Kjkl6zhgPMT145qVOhVOjBeo9vW0oBZQK1oeAkwxpuiwd1DmukxdWwo2b4NQHD7AmmqmBocAmElIxQpXcUc2aSy5XWJ7nA6ahAE9SyhgRLuCLEVd6hpJcqP9zlUQ36J0FW2ytd7wvJS/pkmCCTMiPwbHO7Olqki+gMCk2mf/OKI+bSw2kyPaIBytVIJsnDdrEkuZiy6pChrRJGWccL1+a1aEFg3gCNAgrAbT40re8a98FC/htgeQk8BR25bq5coM5l9eUw
@paulll
paulll / sets.js
Created September 12, 2015 13:29
Проверка, входит ли строка в прямое произведения множества других строк
var set1 = 'Привет, Здраствуй, Здраствуйте, Приветик, Превед, Здаров, Прив, Хелло'.split(', '),
set2 = 'Что, Чего, Што, Чо'.split(', '),
set3 = 'Делаешь, Творишь, Думаешь, Пишешь, Делаете, Пишете, Творите, Думаете'.split(', '),
set = [set1, set2, set3],
str = 'ЗдраствуйтеЧоДелаете';
/**
* Все возможные комбинации можно представить деревом (графом),
* можно найти единственно верный путь, просто отсекая явно неподходящие ветки.
* Получается что-то вроде поиска в глубину с ограничением.
@paulll
paulll / sets.deep.js
Last active September 15, 2015 21:03
Проверка, можно ли составить строку из множеств подстрок (в том числе и вложенных подстрок)
"use strict";
function TokenList (rest, part) {
this.rest = rest.rest.substr(part.length);
this.stack = rest.stack.concat([part]);
this.substr = String.prototype.substr.bind(this.rest);
this.indexOf = String.prototype.indexOf.bind(this.rest);
}
function Input (start) {

Keybase proof

I hereby claim:

  • I am paulll on github.
  • I am paulll (https://keybase.io/paulll) on keybase.
  • I have a public key whose fingerprint is 8175 24E0 F819 D4D1 D720 95B2 7F8B 4FAF 3060 83AF

To claim this, I am signing this object:

@paulll
paulll / webp2gif
Last active March 7, 2020 17:21
Convert webp animation to gif
#!/usr/bin/env zsh
# example usage:
# $ webp2gif input.webp output.gif
dir0=`pwd`
dir=`mktemp -d`
cd $dir
for i in $(seq -f "$04g" 0 1000); do; webpmux -get frame $i $dir0/$1 -o "$i.webp"; done;
mkdir png
for i in {0..1000}; do; dwebp "$i.webp" -o "png/$i.png"; done;
function aob_search()
# use something to identify process id
pid = parse(Int, readall(`pidof osu\!.exe`))
# maps file contains information about memory regions
# mem file is a pseudo-file containing process memory
maps_file = open("/proc/" * string(pid) * "/maps", "r")
mem_file = open("/proc/" * string(pid) * "/mem", "r")
@paulll
paulll / ytmhist2csv.py
Last active March 14, 2020 19:55
Extract YTM playback history from Google Takeout JSON as CSV
import json, re, sys
items = json.load(open('watch-history.json'))
music = (list(x for x in items if x['header'] == 'YouTube Music'))
known_music_channels = {
'Reol Official': 'Reol'
}
counters = {
@paulll
paulll / writeup-2020-unictf-remote-control.py
Last active August 13, 2020 00:22
Unicorn CTF 2020 Task
#!/usr/bin/env python3
"""
Unicorn CTF 2020: Manager on remote work (misc, 999 pts)
Bruteforce solution without z3 or anything except math and force.
Most likely, not the intended solution, but it does work.
Requirements:
python >=3.8 for math.prod
sympy for multiset_permutations
"""