Skip to content

Instantly share code, notes, and snippets.

View miio's full-sized avatar

miio mitani miio

  • Sapporo, Hokkaido, Japan
View GitHub Profile
@miio
miio / FixDS-Lite.bash
Last active October 4, 2024 19:38
UDM Pro で固定IPv4を使いたい場合やDS-Liteが挙動おかしいときに作ったスクリプト
# DS-Lite修正
# 参考
# https://techlog.iij.ad.jp/contents/dslite-raspi
REMOTE=''
# SLAAC シングルの人は多分これでいける
# LOCAL=`ip addr show br0 | grep 'mngtmpaddr' | awk '{print $2}' | awk -F/ '{print $1}'`
# DHCP-PDv6の人はこっち
LOCAL=`ip addr show br0 | grep 'inet6' | grep 'dynamic' | awk '{print $2}' | awk -F/ '{print $1}'`
@miio
miio / vpnclient
Last active August 29, 2015 14:27 — forked from ww24/vpnclient
SoftEther VPN 4 init.d script
#! /bin/sh
### BEGIN INIT INFO
# Provides: vpnclient
# Required-Start: $remote_fs $local_fs $network $syslog
# Required-Stop: $remote_fs $local_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: SoftEther VPN Client
# Description: SoftEther VPN Client
### END INIT INFO
@miio
miio / ggjnw.md
Last active August 29, 2015 14:13
GGJ NW 作業オペ

IGAクローン設定

RTの設定を吸い出してクローンを作成

  • ログインしたらshow configで吸い出す

5F固定IPマシン救済

  • DHCP全部殺す(BRするのにこれしないと多分死ぬ)
  • noなんとかってつけておけばだいたいなんとかなる

5階配線

@miio
miio / equipment_color.rb
Last active January 1, 2016 18:29 — forked from maraigue/equipment_color.rb
ActiveDecorator使うときっとこんな感じになりそう(未検証)
# app/decorators/character_decorator.rb
# for https://github.com/kyubuns/misterioso/commit/3598eec678cf7368e105141b1cd7b8c259f1af12
module CharacterDecorator
EQUIPMENT_COLOR_TABLE = {
1 => 'black',
2 => 'orange',
3 => 'forestgreenq',
4 => 'blue',
@miio
miio / ix2015-ggj2014
Last active January 1, 2016 04:39
GGJ用に仕込み中のIX2015コンフィグ(一部隠してますが
! NEC Portable Internetwork Core Operating System Software
! IX Series IX2010 (magellan-sec) Software, Version 8.3.47, RELEASE SOFTWARE
! Compiled Aug 27-Fri-2010 10:36:11 JST #1
! Last updated Dec 23-Mon-2013 15:57:03 JST
!
!
hostname sanjose
timezone +09 00
!
!
@miio
miio / class.php
Created December 5, 2013 01:31
benchmark test
<?php
class A {
public function getA() {
return "A";
}
}
function getA() {
return "A";
@miio
miio / flickr_exif.rb
Last active December 18, 2015 00:39
require 'flickraw'
require 'open-uri'
require 'exifr'
class ConnectionAdapter
def connection
FlickRaw.api_key = ""
FlickRaw.shared_secret = ""
flickr.access_token = ""
flickr.access_secret = ""
MAP_MIN = 0
MAP_MAX = 3000
BLOCK_SIZE = 10
DEBUG = false
# [level1_rate, level2_rate, ...]
RATE = [
25,
20,
15,
11,
@miio
miio / astar.rb
Last active December 15, 2015 08:39
@near_blocks = []
@cost = nil
def nears(i,j)
[[i-1,j],[i+1,j],[i,j-1],[i,j+1]]
end
def near_astar map_sizes, ignores, target, current
x = current[:x]
y = current[:y]
class UserHighScore < ActiveRecord::Base
belongs_to :user
belongs_to :high_score_partition
attr_accessible :score
after_save do
partition = HighScorePartition.where("(min < ? AND ? > max)", self.score, self.score).first("LOCK IN SHARE MODE")
# Not partition if cheet?
raise "Score not range partition" unless partition
# Not modify
return true partition.id == self.high_score_partition.id