Skip to content

Instantly share code, notes, and snippets.

@aoirint
aoirint / sdtdserver.xml
Created February 12, 2023 08:59
7 Days to Die server Alpha 20.6 default config sdtdserver.xml
<?xml version="1.0"?>
<ServerSettings>
<!-- GENERAL SERVER SETTINGS -->
<!-- Server representation -->
<property name="ServerName" value="My Game Host"/> <!-- Whatever you want the name of the server to be. -->
<property name="ServerDescription" value="A 7 Days to Die server"/> <!-- Whatever you want the server description to be, will be shown in the server browser. -->
<property name="ServerWebsiteURL" value=""/> <!-- Website URL for the server, will be shown in the serverbrowser as a clickable link -->
<property name="ServerPassword" value=""/> <!-- Password to gain entry to the server -->
<property name="ServerLoginConfirmationText" value="" /> <!-- If set the user will see the message during joining the server and has to confirm it before continuing. For more complex changes to this window you can change the "serverjoinrulesdialog" window in XUi -->
@aoirint
aoirint / dam_dx.js
Last active February 9, 2023 07:45
DAM★とも 精密採点DX用 TSV化
// DAM★とも 精密採点DX
var s = '';
// Run in every page (Browser developer console)
// 採点日時 曲リクエストID 曲名 アーティスト名 点数 曲URL 音程 安定性 抑揚 こぶし しゃくり フォール ロングトーンのうまさ ビブラートのうまさ ビブラートタイプ ビブラートタイプURL ビブラート合計秒数
s += jQuery('#DamHistoryMarkingDxListResult')
.find('table')
.map(function(i,e){
var rs = jQuery(e).find('tr');
var reqUrlString = jQuery(rs[1]).find('td').find('a').attr('href');
var reqUrl = new URL(reqUrlString, location.href);
@aoirint
aoirint / dam_ai.js
Last active February 9, 2023 07:48
DAM★とも 精密採点Ai用 TSV化
// DAM★とも 精密採点Ai
var s = '';
// Run in every page (Browser developer console)
// 採点日時 曲リクエストID 曲名 アーティスト名 点数 採点ID 詳細URL 曲URL
s += jQuery('#DamHistoryMarkingAiListResult')
.find('table')
.map(function(i,e){
var cs = jQuery(e).find('td');
var reqUrlString = jQuery(cs[1]).find('a').attr('href');
var reqUrl = new URL(reqUrlString, location.href);
@aoirint
aoirint / docker-entrypoint.sh
Created February 8, 2023 14:35
既存のentrypointを置き換えてubuntu/bind9のログを永続化するシェルスクリプト
#!/bin/bash
set -e
{
/usr/local/bin/docker-entrypoint.sh $@
} \
1> >(tee -a >(sed -u "s/^/[$(date -Ins)] /" >> /bind_logs/named_stdout.log) >&1) \
2> >(tee -a >(sed -u "s/^/[$(date -Ins)] /" >> /bind_logs/named_stderr.log) >&2)
from datetime import datetime
import random
def generate_snowflake_id() -> int:
origin_epoch_millis = 1288834974657 # 2010-11-04T01:42:54.657Z
current_epoch_millis = int(datetime.utcnow().timestamp() * 1000)
timestamp = current_epoch_millis - origin_epoch_millis
return (timestamp << 22) | random.getrandbits(22) # last 22 bits are not random bits actually
print(generate_snowflake_id())
@aoirint
aoirint / background.js
Last active December 2, 2022 23:02
Chrome拡張機能で、VOICEVOX ENGINE宛のリクエストからOriginヘッダを削除するスニペット。VOICEVOX 0.14からエンジンにCORSやOrigin検査が入る予定なので、その対策。Chrome v96 - v108までは動作するはず...(v109以降で動作する・推奨の書き方であるとは限らない)。開発バージョン: Google Chrome 108, VOICEVOX ENGINE 0.14.0-preview.4
chrome.declarativeNetRequest.updateDynamicRules({
removeRuleIds: [1],
addRules: [
{
id: 1,
priority: 1,
action: {
type: 'modifyHeaders',
requestHeaders: [
{ 'header': 'Origin', 'operation': 'remove' },
@aoirint
aoirint / release-binary.yml
Created November 27, 2022 14:48
Release Python Package on GitHub Actions
name: Release Binary
on:
release:
types:
- created
env:
VERSION: ${{ github.event.release.tag_name != '' && github.event.release.tag_name || '0.0.0' }}
#!/bin/bash
# mcpixelmonのバックアップデータサイズを削減するための変換スクリプト
# ゲームファイルやDynmapのキャッシュを含めていたものから、ワールドデータだけを抜き出して再圧縮する
# 所有者維持のため、root権限で実行する
set -eux
set -o pipefail
mkdir -p dest
@aoirint
aoirint / auth_login.dart
Created November 22, 2022 20:29
uguisu用の没コード
import 'package:http/http.dart' as http;
import 'package:logging/logging.dart';
import 'package:sweet_cookie_jar/sweet_cookie_jar.dart';
import 'package:uguisu/niconico_live/cookie_util.dart';
class NiconicoLoginData {
SweetCookieJar cookieJar;
String? userId;
bool mfaRequired;
Uri? mfaFormActionUri;
@aoirint
aoirint / auth.dart
Created November 22, 2022 20:28
uguisu用の没コード
import 'package:http/http.dart' as http;
import 'package:logging/logging.dart';
import 'package:sweet_cookie_jar/sweet_cookie_jar.dart';
class NiconicoAuthSignInMfaNotRequiredResponse {
String userSession;
String userSessionSecure;
NiconicoAuthSignInMfaNotRequiredResponse({
required this.userSession,