Skip to content

Instantly share code, notes, and snippets.

View ShittyCodeMan's full-sized avatar

ShittyCodeMan ShittyCodeMan

View GitHub Profile
@ShittyCodeMan
ShittyCodeMan / JewelFusion.esx
Last active October 2, 2025 06:35
Skyrim SE MOD 首飾りと指輪の消費マジカ低減系付呪を精霊の鋳造器具で融合 必須MOD: DennysPapyrusFunctions
<?xml version="1.0" encoding="UTF-8"?>
<plugin version="0.7.4">
<TES4 flags="0x00000200" id="00000000" day="0" month="0" lastUserID="0" currentUserID="0" version="44" unknown="0x0000">
<HEDR>
<struct version="1.71000004" numRecords="7" nextObjectID="00000800" />
</HEDR>
<CNAM></CNAM>
<MAST>Skyrim.esm</MAST>
<DATA>0</DATA>
</TES4>
@ShittyCodeMan
ShittyCodeMan / fastGacha.js
Last active September 16, 2025 09:56
分位点関数を使った高速ガチャ回し
// ---- RNG interface (optional DI) ----
function defaultRng() { return Math.random(); }
// ---- Lanczos log-gamma (安定な log Γ) ----
function logGamma(z) {
const p = [
676.5203681218851, -1259.1392167224028, 771.32342877765313,
-176.61502916214059, 12.507343278686905, -0.13857109526572012,
9.9843695780195716e-6, 1.5056327351493116e-7
];
import sys
import math
from functools import cache
@cache
def de_bruijn_bits(n):
k = 2
a = [0] * k * n
sequence = [0]
from enum import IntEnum, auto
from urllib.request import urlopen
import lzma
import json
class DamageType(IntEnum):
Impact = 0
Puncture = auto()
Slash = auto()
Heat = auto()
@ShittyCodeMan
ShittyCodeMan / lightsout_solver.js
Last active April 4, 2025 07:52
ライツアウトのソルバーをNode.jsに移植して入力CLIを実装したやつ
const readline = require("readline");
const RESET = "\x1b[0m";
const REVERSE = "\x1b[7m";
const LIGHT = "#";
const DARK = ".";
const GOAL_STATE = 1;
const GRID_WIDTH = +process.argv[2] || 10;
const GRID_HEIGHT = +process.argv[3] || GRID_WIDTH;
@ShittyCodeMan
ShittyCodeMan / Poe2CurrencyExchangeRatio.js
Last active March 28, 2025 06:48
Path of Exile 1~2のカレンシー交換で小数点以下第二位表記の安価カレンシー/1高価カレンシーを整数の比に直すスクリプト
v=2.26;a=Math.round(v*100);b=100;while(a%=b)[a,b]=[b,a];[Math.round(100/b*v),100/b]
@ShittyCodeMan
ShittyCodeMan / check_twitch_drops.py
Last active March 28, 2025 07:12
Twitchドロップの残り時間をcmdで確認する
import requests
import math
import sys
import time
import ctypes
from functools import reduce
kernel32 = ctypes.windll.kernel32
kernel32.SetConsoleMode(kernel32.GetStdHandle(-11), 7)
@ShittyCodeMan
ShittyCodeMan / group_popularity.js
Last active October 10, 2024 23:03
村人の友好関係 (paizaランク S 相当)
//どう足掻いてもテストケースがタイムアウトするしにたい
class Node {
constructor(data, next = null) {
this.data = data;
this.next = next;
}
}
let lines = require('fs').readFileSync("/dev/stdin", "utf8").split("\n");
const [N, M, Q] = lines[0].split(" ").map(Number);
@ShittyCodeMan
ShittyCodeMan / mod7.js
Last active October 7, 2024 03:31
mod7占い (paizaランク S 相当)
lines = require('fs').readFileSync("/dev/stdin", "utf8").split`\n`;
const N = +lines[0];
const CARDS = lines.slice(1).map(Number);
let count = 0;
for (let i = 0; i < N-2; i++) {
for (let j = i+1; j < N-1; j++) {
for (let k = j+1; k < N; k++) {
if ((CARDS[i] + CARDS[j] + CARDS[k]) % 7 === 0) {
count++;
@ShittyCodeMan
ShittyCodeMan / search-island.js
Last active October 7, 2024 03:31
島探し (paizaランク S 相当)
lines = require('fs').readFileSync("/dev/stdin", "utf8").split`\n`;
const [M, N] = lines[0].split` `.map(Number);
let world = lines.slice(1, N+1).map(v => v.split` `.map(Number));
let count = 0;
const sinkIsland = sinkIslandEx.bind(null, M, N);
for (let y = 0; y < N; y++) {
for (let x = 0; x < M; x++) {
if (world[y][x] === 1) {