Skip to content

Instantly share code, notes, and snippets.

@kusano
kusano / htr_qt3.py
Created April 29, 2025 16:19
HTR Subsets U2
# 0---1
# /| /|
# 3---2 |
# | 4-|-5
# |/ |/
# 7---6
import itertools
import random
from itertools import permutations
def normalize(s):
C = []
for ud in range(2):
if ud==0:
ud = {"U": "U", "D": "D"}
else:
ud = {"U": "D", "D": "U"}
for xy in range(2):
from itertools import permutations
def normalize(s):
C = []
for ud in range(2):
if ud==0:
ud = {"U": "U", "D": "D"}
else:
ud = {"U": "D", "D": "U"}
for xy in range(2):
@kusano
kusano / htr2ls.txt
Created August 23, 2024 16:34
HTRからleave sliceの最短手順
This file has been truncated, but you can view the full file.
F2 L2 B2 D2 B2 L2 F2
R2 F2 B2 U2 B2 R2 D2 L2 F2
F2 L2 F2 L2 D2 F2 L2 U2 F2 R2
F2 D2 B2 R2 D2 L2 B2
R2 U2 R2 F2 B2 R2 D2
R2 U2 F2 R2 D2 B2 L2 U2 R2
R2 F2 L2 D2 R2 L2 F2 L2 B2
B2 L2 B2 L2 D2 F2 L2 D2 F2 L2 U2
D2 F2 R2 F2 R2 L2 D2 B2 R2
B2 R2 U2 B2 L2 D2 L2 F2 U2
# Slackのアーカイブ中のトークンの付いたURLをダウンロードする。
# python3 slack_download.py 'xxx Slack export mmm dd yyyy - mmm dd yyyy/' out/ 'xoxe-...'
import sys
import os
import json
import urllib.parse
import urllib.request
indir = sys.argv[1]
@kusano
kusano / update.sh
Created February 7, 2024 16:07
ddns
TOKEN='...'
ZONE_ID='...'
DNS_RECORD_ID='...'
DOMAIN='hoge.example.com'
IP=$(curl https://checkip.amazonaws.com/)
curl \
--request PUT \
--url "https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/dns_records/${DNS_RECORD_ID}" \
#include <iostream>
#include <cstdint>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <functional>
using namespace std;
#include <iostream>
#include <cstdint>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <functional>
using namespace std;
@kusano
kusano / A_A.py
Created April 15, 2023 18:07
Google Code Jam Farewell Round
T = int(input())
for t in range(T):
D = list(map(int, input().split()))
N = int(input())
S = set()
for i in range(N):
s = input()
s = "".join(str(D[ord(c)-ord("A")]) for c in s)
S.add(s)
if len(S)==N:
import random
# ババ抜きをシミュレート
# n: 人数
# s: 配り始める人
def simulate(n, s):
C = [0]
for i in range(1, 14):
C += [i]*4
random.shuffle(C)