Skip to content

Instantly share code, notes, and snippets.

@opparco
opparco / cgi_exe.py
Created January 28, 2017 20:32
PaintsChainer server on CPU
#!/usr/bin/env python
"""
from https://github.com/taizan/PaintsChainer/blob/master/cgi-bin/paint_x2_unet/cgi_exe.py
This code allows you to colorize on CPU (without CUDA).
$ python server.py
@opparco
opparco / mvunpack.py
Last active April 2, 2017 13:08 — forked from requiredinformation/mvunpack.py
Quick and dirty RPGMaker MV asset decryptor (decrypts www/img/*.rpgmvp and www/audio/*.rpgmvo)
#!/usr/bin/env python3
import glob
import json
import sys
import shutil
import os
#this might change, not sure, but probably not since 16 is a great number
HEADER_LENGTH = 16
@opparco
opparco / atsumaru.ts
Created April 21, 2017 05:43
handle virtual controller input on RPGAtsumaru
interface Window {
RPGAtsumaru;
}
class RPGAtsumaruState {
buttons;
next: Function;
create() {
this.buttons = {
@opparco
opparco / pixelate.py
Created May 23, 2017 13:38
ドット絵こんばーたをローカル環境で動かす
#!/usr/bin/python
#
# pixelate.py
#
# https://github.com/tsutsuji815/pixel_convert
#
# pip install opencv-python
# pip install Pillow
@opparco
opparco / pngreader.ts
Last active May 24, 2017 02:45
read PNG magic.
/**
* read PNG file.
*/
import * as fs from 'fs';
function putUsage(): void
{
const usage = "Usage: node pngreader.ts source.png";
console.log(usage);
}
@opparco
opparco / armature_export.patch
Last active August 1, 2017 09:48
Fix armature exporter. Not consider rotation.
--- armaturesys\armature_export.py.orig 2015-01-27 08:38:31.732200600 +0900
+++ armaturesys\armature_export.py 2017-08-01 18:33:26.455402600 +0900
@@ -275,19 +275,22 @@ class Armature():
return correction_matrix * matrix
elif (space == 'BONESPACE'):
if bone.parent:
- # not sure why extra = True is required here
- # but if extra = extra then transforms are messed up, so keep
- # for now
- parinv = self.get_bone_rest_matrix(bone.parent, 'ARMATURESPACE',
diff --git a/lib/bcdice/user_defined_dice_table.rb b/lib/bcdice/user_defined_dice_table.rb
index 11c8938..ca2b086 100644
--- a/lib/bcdice/user_defined_dice_table.rb
+++ b/lib/bcdice/user_defined_dice_table.rb
@@ -52,7 +52,7 @@ module BCDice
return false
end
- index_list = @rows.map(&:to_i).unique.sort
+ index_list = @rows.map(&:to_i).uniq.sort
@opparco
opparco / opal_mt-1.js
Created October 3, 2020 09:58
random test
// https://github.com/opal/opal/blob/b1074a37150f9b0b53a35f0efa4a1cbddc02ba29/opal/corelib/random/mersenne_twister.rb
// node opal_mt.js
var mt19937 = (function() {
/* Period parameters */
var N = 624;
var M = 397;
var MATRIX_A = 0x9908b0df; /* constant vector a */
var UMASK = 0x80000000; /* most significant w-r bits */
var LMASK = 0x7fffffff; /* least significant r bits */
var MIXBITS = function(u,v) { return ( ((u) & UMASK) | ((v) & LMASK) ); };
@opparco
opparco / NodeMap.cpp
Last active February 15, 2021 04:25
CBPFO4 NodeMap
#include <set>
#include "NodeMap.h"
std::unordered_map<NiNode *, std::unordered_map<std::string, NiNode *> > m_nodes_container;
void DeleteNodeMap(NiNode * rootnode)
{
_DMESSAGE("DeleteNodeMap rootnode %p", rootnode);
m_nodes_container.erase(rootnode);
for code in "1000".."9999"
a, b, c, d = code.bytes.map {|byte| byte - 0x30}
n = code.to_i
x = a + b + c + d
# min(x) = 1
# max(x) = 36
next if x == 1