This file contains 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/bash | |
# 出力先のテキストファイル名 | |
output_file="inhabited_times.txt" | |
# 既存の出力ファイルがあれば削除 | |
rm -f "$output_file" | |
# 現在のディレクトリ内のすべての.mcaファイルを処理 | |
for file in *.mca; do |
This file contains 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
function generateExpressions(target, count, maxNum) { | |
const operators = ['+', '-', '*', '/']; | |
let n=0; | |
while (n < count) { | |
const nums = []; | |
const ops = []; | |
let numCount = Math.floor(Math.random() * 4) + 2; | |
for (let i = 0; i < numCount; i++) { | |
nums.push(Math.floor(Math.random() * maxNum) + 1); |
This file contains 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
# on m1 mac | |
1. brew install lima | |
2. limactl start # defaultという名前のマシンが作られる。これがarm64になっている。 | |
3. ~/.lima/default/lima.yaml を、 ~/.lima/x86_64.yaml にコピーする | |
4. limactl delete default でdefaultマシンを削除 | |
5. arch: null を、 arch: "x86_64" に変更して保存 | |
6. limactl start x86_64.yaml として新しくマシンを作成、起動 | |
7. limactl shell x86_64 | |
8. uname -a |
This file contains 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
(function() { | |
var debug = false; | |
var root = this; | |
var EXIF = function(obj) { | |
if (obj instanceof EXIF) return obj; | |
if (!(this instanceof EXIF)) return new EXIF(obj); | |
this.EXIFwrapped = obj; |
This file contains 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
#! node | |
if(process.argv.length<=2) process.exit(1); | |
const { Configuration, OpenAIApi } = require("openai"); | |
const configuration = new Configuration({apiKey: process.env.OPENAI_API_KEY}); | |
const openai = new OpenAIApi(configuration); | |
const wrap = fn => { | |
return (req, res, next) => { | |
return fn(req, res, next).catch(next); | |
} |
This file contains 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
# Echo server program | |
import socket | |
HOST = '' # Symbolic name meaning all available interfaces | |
PORT = 50007 # Arbitrary non-privileged port | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.bind((HOST, PORT)) | |
s.listen(1) | |
conn, addr = s.accept() |
This file contains 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
// | |
// ViewController.h | |
// cameratest3gameobjc | |
// | |
// Created by ringo on 2022/03/16. | |
// | |
#import <Cocoa/Cocoa.h> | |
#import <SpriteKit/SpriteKit.h> | |
#import <GameplayKit/GameplayKit.h> |
This file contains 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
基本構造 | |
Proxy構成ではなく、paperのサーバー単体でUDP 19132に対応させる場合の設定。 | |
サーバー側 | |
1. Geyser-Spigot.jar と floodgate-spigot.jar をダウンロードする。よくファイル名変わるので、Geyser, floodgate でぐぐって最新をあたれ | |
2. paper/pluginsにどっちも入れる。 | |
3. 起動する。と、plugins/Geyser-Spigotができる | |
4. Geyser-Spigot/config.yml の "auth-type: online"を、 "auth-type: floodgate"に書き換える。ドキュメントだと自動で選択されるとあるけど、自動ではなかった。 | |
5. 再起動する。Geyserはreloadが効かずエラーになる。 |
This file contains 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
#!ruby -Ku | |
# Author: takeda yoshiki | |
res_hash = { | |
"ret" => false, | |
"error" => "", | |
} | |
begin | |
require 'pp' | |
require 'json' | |
# 取得するデータ |
This file contains 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
簡易的なサーバー自動再起動の設定方法は、 | |
サーバーの実行ファイルをシェルスクリプトから起動する。 | |
シェルスクリプトの中で永久ループを使う。 | |
endless.shを以下のように設定する | |
``` | |
ulimit -n 4000 # なくてもいい。TCPのサーバーだと便利なときもある | |
while true; do | |
date # 起動の日付がログに残ってると便利 |
NewerOlder