Skip to content

Instantly share code, notes, and snippets.

View amane-katagiri's full-sized avatar

Amane Katagiri amane-katagiri

View GitHub Profile
@amane-katagiri
amane-katagiri / deterministic-zip.sh
Last active June 3, 2021 05:51
同じファイル群に対して同じバイナリのアーカイブを生成する
#!/bin/sh
ARCHIVE="$1"
TARGET="$2"
find "$TARGET" -exec touch -t 198001010000 '{}' +
find "$TARGET" -print0 | tr '\0' '\n' | LC_ALL=C sort | zip -@ -X "$ARCHIVE"
@amane-katagiri
amane-katagiri / command.py
Last active April 6, 2021 05:11
Export my RSS feeds on slack manage page.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import sys
__author__ = "Amane Katagiri"
__contact__ = "amane@ama.ne.jp"
__copyright__ = "Copyright (C) 2018 Amane Katagiri"
__credits__ = ["Amane Katagiri", ]
@amane-katagiri
amane-katagiri / LICENSE
Last active March 24, 2021 15:57
Wiki.jsでPGroongaを用いて全文検索を行う(/wiki/server/modules/search/pgroonga あたりに配置)
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
@amane-katagiri
amane-katagiri / index.html
Created March 9, 2021 08:23
チェックボックスでスタイルを切り替える
<html>
<head>
<title>チェックボックスでスタイルを切り替える</title>
<style>
#main {
background-color: red;
}
input[type="checkbox"]#toggle:checked ~ #main {
color: #eee;
background-color: blue;
@amane-katagiri
amane-katagiri / custom.css
Created January 11, 2021 18:48
https://forum.amane.moe/ で default-dark/theme.css に追加して使用しているCSS (under GNU Affero General Public License v3.0)
.h-entry {
min-width: 80%;
min-height: 0;
}
.h-entry main {
margin: 0 20px;
}
.card h3 {
margin: 20px;
}
@amane-katagiri
amane-katagiri / dnskey_to_dsrecord.py
Created December 21, 2020 00:56 — forked from wido/dnskey_to_dsrecord.py
Calculate DS record from DNSKEY with Python 3
"""
Generate a DNSSEC DS record based on the incoming DNSKEY record
The DNSKEY can be found using for example 'dig':
$ dig DNSKEY secure.widodh.nl
The output can then be parsed with the following code to generate a DS record
for in the parent DNS zone
@amane-katagiri
amane-katagiri / build-python.sh
Last active July 30, 2020 02:44
パイソンのビルドは温かみのある手で
#!/bin/bash -ue
VERSION="$1"
sudo apt install build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \
libjpeg-dev libncurses5-dev libncursesw5-dev liblzma-dev tk-dev xz-utils libffi-dev \
libgdbm-dev libdb-dev libffi-dev uuid-dev wget
cd /tmp
wget -O - "https://www.python.org/ftp/python/$VERSION/Python-$VERSION.tgz" | tar zxvf -
@amane-katagiri
amane-katagiri / danime_list.sh
Last active July 5, 2020 11:58
ランダム・アニメ・ピックアップ
#!/bin/bash -Ceu
URL_ROOT='https://anime.dmkt-sp.jp/animestore/rest/WS000108'
LENGTH=300
for KANA_COLUMN in $(seq 1 10); do
for KANA_ROW in $(seq 1 5); do
TEMP=$(mktemp)
curl -o $TEMP -Ss "$URL_ROOT"'?workTypeList=anime&length='"$LENGTH"'&initialCollectionKey='"$KANA_COLUMN"'&consonantKey='"$KANA_ROW"'&vodTypeList=svod_tvod'
ERROR="$(cat $TEMP | jq -r '.error.code')"
if [ "$ERROR" == "null" ]; then
@amane-katagiri
amane-katagiri / client_secrets.json
Last active May 21, 2020 10:20
List shared links in your Google Drive.
{
"web":
{
"client_id": "XXX",
"project_id": "XXX",
"auth_uri":"https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_secret": "XXX",
"redirect_uris": ["http://localhost:8080/"],
@amane-katagiri
amane-katagiri / girondl
Last active May 18, 2020 03:25
画像で議論
#!/bin/bash -eu
GIRON_URL='https://rara.jp/giron/photo'
DOWNLOAD_DIR=$HOME/Pictures/tmp
MAX_PAGE=10
CURSOR=$DOWNLOAD_DIR/.last_download_url
VERBOSE=0
CURL_OPT="-Ss"
if [ $# -gt 0 ]; then
if [ "$1" = "-v" ]; then