This file contains hidden or 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 sim(alg): | |
state = "UF UR UB UL DF DR DB DL FR FL BR BL UFR URB UBL ULF DRF DFL DLB DBR".split() | |
for move in alg.split(): | |
perm = "FLBR FRBL FDBU FUBD URDL ULDR".split()['UDLRFB'.index(move[0])] | |
n = 2 + "2'".find(move[-1]) | |
table = str.maketrans(perm, perm[n:] + perm[:n]) | |
state = [p.translate(table) if move[0] in p else p for p in state] | |
return state | |
print(sim("D L2 B2 L2 R2 F2 R2 U2 R2 D' U' R' B F L' D R2") == sim("U R B F L D R2")) |
This file contains hidden or 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
#!/bin/sh | |
# Optional accompaniment to password_fill_rc (in case no existing graphical password askpass for lpass to use) | |
# put in ~/.config/qutebrowse/lpass_askpass_zenity | |
# and enable in password_fill_rc with need_askpass=1 | |
zenity --title "lpass $*" --password |
This file contains hidden or 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 python3 | |
import os | |
import subprocess | |
import sys | |
dir_path = os.path.dirname(os.path.realpath(__file__)) | |
subprocess.call('cat ' + sys.argv[-1] + ' | ' | |
+ os.path.join(dir_path, 'detex.py') + ' | ' |
This file contains hidden or 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
template <int MAXV, class T = int> struct Dinic { | |
const static bool SCALING = false; // non-scaling = V^2E, Scaling=VElog(U) with higher constant | |
int lim = 1; | |
const T INF = numeric_limits<T>::max(); | |
struct edge { | |
int to, rev; | |
T cap, flow; | |
}; | |
int s = MAXV - 2, t = MAXV - 1; |