Skip to content

Instantly share code, notes, and snippets.

@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)
@kusano
kusano / main4.py
Created September 23, 2022 10:19
天下一Game Battle Contest 2022
import os
import sys
import random
import json
import time
import urllib.request
import urllib.error
from copy import deepcopy
# ゲームサーバのアドレス / トークン
from fractions import Fraction
import math
import random
# 内積
def prod(u, v):
return sum(x*y for x, y in zip(u, v))
# Gram-Schmidtの直交化
# GSOベクトルのノルムの2乗 [|b0|^2, |b1|^2, ...] とGSO係数 mu を返す。
Wordle 386 4/6
⬜⬜⬜⬜⬜
🟨🟩🟩⬜⬜
⬜⬜⬜⬜🟩
🟩🟩🟩🟩🟩
Wordle 387 4/6
🟨⬜🟩⬜⬜
@kusano
kusano / eevee.txt
Last active August 27, 2022 03:09
イーブイ
ブースター
シャワーズ
サンダース
リーフィア
ブラッキー
エーフィ
@kusano
kusano / A.py
Created May 14, 2022 16:53
Google Code Jam 2022 Round 2
T = int(input())
for t in range(1, T+1):
N, K = map(int, input().split())
V = [1]
for i in range(2, N, 2)[::-1]:
for j in range(4):
V += [V[-1]+i]
V += [N*N, N*N]
d = N*N-1-K
c = 0