Skip to content

Instantly share code, notes, and snippets.

View bgnori's full-sized avatar

Noriyuki Hosaka bgnori

  • Itabashi, Tokyo, Japan
View GitHub Profile
#!/bin/python
import math
def smartsub(N, k):
if k == 0:
return 1
""" k > 1 """
d, m = divmod(N, 10**k)
{
init: function(elevators, floors) {
var A = elevators[0];
A.on("idle", function() {
A.goToFloor(0);
});
A.on("floor_button_pressed", function(floorNum) {
if (A.currentFloor < floorNum) {
A.goingUpIndicator(true)
package main
import (
"crypto/rand"
"encoding/base64"
"encoding/binary"
"fmt"
"github.com/seehuhn/mt19937"
)
package main
import (
"crypto/rand"
"encoding/base64"
"fmt"
)
func main() {
#/usr/bin/python
# coding: utf-8
from sqlalchemy.engine import create_engine
from sqlalchemy.engine import create_engine
from sqlalchemy.orm.session import sessionmaker
from sqlalchemy.sql.expression import and_
from sqlalchemy.schema import Column
from sqlalchemy.dialects.postgresql import DATE, VARCHAR, DOUBLE_PRECISION, BIGINT, INTEGER, NUMERIC
from sqlalchemy.dialects.postgresql import TIMESTAMP
nori@Nagato:~/.go/src/github.com/bgnori/npoker$ /usr/local/go/bin/go run main.go
18.849115秒
3 players, 1000000 trials
player 0 has J♠,J♣, won 0.189, won eq of 186.78.
player 1 has A♠,A♥, won 0.714, won eq of 708.11.
player 2 has K♦,A♦, won 0.111, won eq of 105.10.
nori@Nagato:~/.go/src/github.com/bgnori/npoker$ /usr/local/go/bin/go run main.go
49.913845秒
package main
import (
"encoding/json"
"fmt"
"os"
)
type LINEContent struct {
ToType int `json:"toType"`
package main
import "fmt"
import "image/color"
import "strconv"
func p256(s string) uint8 {
i, _ := strconv.ParseUint(s, 16, 8)
return uint8(i)
}
@bgnori
bgnori / hoge.py
Last active August 29, 2015 14:27
1000,流動資産
1100,当座資産
1110,現金及び預金
1111,現金
1112,預金
1120,受取手形
1121,受取手形,関係会社のものを除く。
1127,子会社受取手形
1128,その他の関係会社受取手形
(1129),貸倒引当金
# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings: version 352.21 (buildd@lcy01-07) Thu Jun 18 12:03:14 UTC 2015
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
Option "Xinerama" "0"
EndSection