Skip to content

Instantly share code, notes, and snippets.

mod_moving_state = {direction = nil, tick = 0}
commands.add_command("keep_going", nil, function(command)
mod_moving_state = {direction = defines.direction.north, tick = 30}
end)
script.on_event(defines.events.on_tick,
function(event)
if mod_moving_state.tick > 0 then
@choro3
choro3 / keybase.md
Created December 27, 2017 14:59
keybase.md

Keybase proof

I hereby claim:

  • I am choro3 on github.
  • I am choro3 (https://keybase.io/choro3) on keybase.
  • I have a public key whose fingerprint is 7404 A81D AD63 A3B5 E411 0B32 BEAB 4EA5 9598 C188

To claim this, I am signing this object:

extern crate rand;
use rand::Rng;
use std::cmp;
use std::fs::File;
use std::io::prelude::*;
use std::io::BufReader;
use std::path::Path;
use std::fmt;
// static mut isprime: [bool; 1000000] = [true; 1000000];
// dest node id, cost
struct Edge(usize, i64);
// current node, total cost
// struct State(usize, i64);
#[derive(Copy, Clone, Eq, PartialEq)]
struct State {
node: usize,
cost: i64
@choro3
choro3 / ks.cfg
Last active September 25, 2015 15:51
sudo と ssh だけできるVMを作成するための Kickstart 設定
# Kickstart file automatically generated by anaconda.
#version=DEVEL
install
autostep
reboot
url --url=http://ftp.jaist.ac.jp/pub/Linux/CentOS/6.7/os/x86_64
lang ja_JP.UTF-8
keyboard us
network --onboot yes --device eth0 --bootproto dhcp --ipv6 auto
import System.Environment
import Data.List
import Control.Applicative
data Field = Field (Int, Int) (Int, Int)
size :: Field -> (Int, Int)
size (Field (w, h) _) = (w, h)
pos :: Field -> (Int, Int)
@choro3
choro3 / gist:7248776
Created October 31, 2013 12:22
mroongaとspiderをインストールするchef recipe。 ubuntu/linux mint用
#
# Cookbook Name:: mroonga
# Recipe:: default
#
# Copyright 2013, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
["cmake",
@choro3
choro3 / gist:6783584
Created October 1, 2013 19:15
ランダムにn行出力
#!/usr/bin/env python
# coding: utf-8
import sys
import random
import argparse
def main(filename, linecount):
with open(filename, 'r') as f:
_l = sum(1 for _ in f)
# coding: utf-8
"""
Yahooファイナンスからトルコリラ/円の為替レートを取得するだけ
"""
import sys
import argparse
import urllib
@choro3
choro3 / fid.py
Created May 5, 2013 13:49
高速文字列解析の世界 p42 完備辞書(ビットが密な場合) ほんとに正しく実装出来てる?
# coding: utf-8
# 完備辞書 (p.42
# 密なばあい
from math import log, ceil
class FID (object):
def __init__(self, seq=long(0), N=65536):