Skip to content

Instantly share code, notes, and snippets.

View lifthrasiir's full-sized avatar

Kang Seonghoon lifthrasiir

View GitHub Profile
@lifthrasiir
lifthrasiir / lex.rs
Last active December 14, 2015 09:18
Simple lexical analyzer for Rust
/// Returns a length of the longest prefix of given string, which
/// `uint::from_str` accepts without a failure, if any.
pub pure fn scan_uint(s: &str) -> Option<uint> {
match str::find(s, |c| !('0' <= c && c <= '9')) {
Some(first) if first > 0u => Some(first),
None if s.len() > 0u => Some(s.len()),
_ => None
}
}
def run(limit=None):
import os, array, struct, time, zlib
if limit is None: limit = time.time() - 3*3600
for i in os.listdir('.'):
if not i.endswith('.mca'): continue
_,ccx,ccz,_ = i.split('.')
ccx = int(ccx) * 32; ccz = int(ccz) * 32
with open(i, 'rb') as f:
offsets = array.array('I', f.read(4096)); offsets.byteswap()
timestamps = array.array('I', f.read(4096)); timestamps.byteswap()
@lifthrasiir
lifthrasiir / kshootmania.vim
Created June 13, 2013 14:07
Vim highlighting for K-Shoot Mania
" Syntax file for K-Shoot Mania pattern file
" Maintainer: Kang Seonghoon <[email protected]>
" Last Change: 2013 Jun 13
" License: Public domain
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
@lifthrasiir
lifthrasiir / index.html
Last active October 4, 2017 14:44
K-Shoot MANIA to EffectDrive/SDVXviewer converter
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>K-Shoot MANIA to EffectDrive/SDVXviewer converter</title>
</head>
<body>
<h1><a href="http://kshoot.client.jp/">K-Shoot MANIA</a> to <a href="http://effectdrive.web.fc2.com/">EffectDrive</a>/<a href="http://sdvxviewer.wiki.fc2.com/">SDVXviewer</a> converter</h1>
<table border="1" width="80%" style="text-align:center">
<tr><th width="50%">K-Shoot MANIA pattern (<code>*.txt</code>) here</th><th width="50%">Save this to EffectDrive's <code>Drv\*\*.drv</code></th></tr>
@lifthrasiir
lifthrasiir / gist:5933501
Last active December 19, 2015 09:29
majordomo protocol overview
>>> import zmq
>>> c=zmq.Context()
>>> s1=c.socket(zmq.REQ)
>>> s2=c.socket(zmq.ROUTER)
>>> s3=c.socket(zmq.DEALER)
>>> s2.bind('inproc://a')
>>> s1.connect('inproc://a')
>>> s3.connect('inproc://a')
>>> s3.send_multipart(['', '<register>']) # <> <register>
>>> s2.recv_multipart() # <worker id> <> <register>
@lifthrasiir
lifthrasiir / encoding.rs
Created July 27, 2013 20:01
Character encoding interface for Rust (proof-of-concept)
mod util {
use std::str::CharRange;
pub struct StrCharIndexIterator<'self> {
priv index: uint,
priv string: &'self str,
}
impl<'self> Iterator<(uint, uint, char)> for StrCharIndexIterator<'self> {
#[inline]
@lifthrasiir
lifthrasiir / gist:6118673
Created July 31, 2013 01:47
사볼 창작 채보 감상 2013-07-31

아는 사람은 알지만 deception 작업한 이래로 니코동 SDVX創作譜面動画 태그를 빠짐 없이 보고 있는데... 재밌는 패턴이 많다. K-Shoot MANIA 에디터 나온 뒤로는 그냥 흘러 넘치는 수준. IRC에서 괜찮다고 얘기했던 것들 몇 개를 골라서 올려 봄. 개인적인 레벨은 편의상 사볼 난이도와 K-Shoot MANIA 자체 난이도(15를 15~20으로 분화, 맥버를 18로 잡음)를 함께 표시. 아이고 근데 벌써 이런 시간이...

※ 좋은 보면 - 레벨에 연연하지 않고 퀄리티에 중점을 둠.

http://www.nicovideo.jp/watch/sm21173590 リリーゼと炎龍レーヴァテイン 릴리제와 염룡 레바테인 [Lv 15약/15, 노트 1676] - 원핸드 구간이 있긴 하지만 난이도에 결정적인 영향을 미칠 정도로 속도감이 있진 않다. 전반적으로 느린 보스곡의 느낌을 주는 패턴. 물론 곡과는 싱크로가 높으며, 편집기도 없던 시절에 잘만 이펙터를 넣어서 호평을 얻었다(...).

http://www.nicovideo.jp/watch/sm21372249 サンレス水郷 선레스 수향 [Lv 11, 노트 1139] - FF13 OST 수록곡. 커팅도 잘 했고 이펙터도 잘 먹였음. 표기 레벨은 12인데 노트 밀집도는 10이라서 고민했는데, 신들의 기도(본가에서 레벨 11임)과 비슷한 난이도라는 판단 하에 11로 책정.

http://www.nicovideo.jp/watch/sm21394748 Calamity Fortune [Lv 15중/16~17, 노트 1658] - 원곡은 BMS. (참고로 작곡가가 괴음악 리믹스의 그 사람) 원곡이 리듬게임에 맞춰서 작곡된 음악이니만큼 채보 만들긴 수월했을 듯. 본가와 비교하면 대우주 스테이지 강화판에 라쿠가키스트 정도 난이도. 채보적인 면에서는 직각 노브 + FX숏 x 2가 독보적(이지만 알고 나면 쉽다).

@lifthrasiir
lifthrasiir / md5.rs
Created November 16, 2013 15:53
MD5 in Rust
// This is a part of Sonorous.
// Copyright (c) 2005, 2007, 2009, 2012, 2013, Kang Seonghoon. (But see below)
// See README.md for details.
//
// This code is placed in the public domain and the author disclaims any copyright.
// Alternatively, for jurisdictions where authors cannot disclaim their copyright,
// this source code is distributed under the terms of CC0 1.0 Universal license
// as published by Creative Commons <https://creativecommons.org/publicdomain/zero/1.0/>.
//
// This is a translation of the independent implementation of the MD5 digest algorithm due to
@lifthrasiir
lifthrasiir / hgwebdir.php
Last active January 1, 2016 21:09
Simple hgwebdir-to-bitbucket translation script for hg.mearie.org
<?php
// hgwebdir.php
// Written by Kang Seonghoon, 2014-01-01 (!)
// Public domain. No warranty guaranteed.
define('YEAR_SCALE', 3600 * 24 * 365);
define('MONTH_SCALE', 3600 * 24 * 30);
define('WEEK_SCALE', 3600 * 24 * 7);
define('DAY_SCALE', 3600 * 24);
define('HOUR_SCALE', 3600);
@lifthrasiir
lifthrasiir / how-to-install-rust-nightly.md
Last active January 3, 2016 01:08
Rust 나이틀리 스냅샷 설치하기 / How to Install a Nightly Snapshot for Rust

Rust 나이틀리 스냅샷 설치하기

Rust는 현재 개발중인 언어이며 지속적으로 바뀌고 있습니다. 따라서 새로운 기능이 필요하거나 컴파일러 버그를 덜 겪으려면 최대한 최근의 버전을 사용하는 게 좋습니다.

0.8, 0.9와 같은 버전이 붙은 릴리스는 개발 일정 관리를 위해서만 존재하기 때문에 3개월에 한 번씩만 만들어집니다. 그래서 최신 버전(master 버전이라고 부릅니다)의 소스를 받아서 컴파일하는 게 가장 좋습니다. 하지만 컴파일이 어렵거나 시간이 많이 걸린다면 비교적 최근(1~2주 이내)의 master를 미리 컴파일해 놓은 나이틀리 스냅샷(nightly snapshot)을 사용하는 것도 한 방법입니다.