Skip to content

Instantly share code, notes, and snippets.

View IshitaTakeshi's full-sized avatar
💭
kernel panic

Takeshi Ishita IshitaTakeshi

💭
kernel panic
View GitHub Profile
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# マインスイーパー
# コマンドライン引数にヨコ、タテ、地雷の数を渡してあげると動きます
# 入力を求められるので掘りたいマスの座標をスペースで区切って渡してあげてください
#
import sys
import random
@IshitaTakeshi
IshitaTakeshi / file1.txt
Created August 4, 2014 03:15
ガウス消去法をPythonで書いてみた ref: http://qiita.com/IshitaTakeshi/items/a89c700769148f1d4749
[ 1 2 0 -1]
[ 3 7 -1 3]
[ 2 2 1 2]
[ 1 2 0 -1]
[ 0 1 -1 6]
[ 2 2 1 2]
[ 1 2 0 -1]
[ 0 1 -1 6]
@IshitaTakeshi
IshitaTakeshi / digits_recognition.py
Last active September 25, 2015 12:05
高速、高精度、省メモリな線形分類器、SCW ref: http://qiita.com/IshitaTakeshi/items/3e41d3ec045422f7b8d8
from __future__ import division
import time
import numpy as np
from sklearn.datasets import load_digits, make_classification
from sklearn.svm import SVC
from matplotlib import pyplot
from scw import SCW1
*.pyc
*.diff
@IshitaTakeshi
IshitaTakeshi / kalman.py
Last active August 29, 2015 14:17
The kalman filter
#!/usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
from matplotlib import pyplot
from numpy.random import multivariate_normal
class StateViewer(object):
def __init__(self, dt, n_iterations):
@IshitaTakeshi
IshitaTakeshi / svmlight_loader.jl
Last active August 29, 2015 14:27
svmlight / liblinear format file loader
# svmlight / liblinear format file loader
# The MIT License (MIT)
#
# Copyright (c) 2015 Ishita Takeshi
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@IshitaTakeshi
IshitaTakeshi / regression.jl
Last active March 16, 2016 07:57
Polynomial Regression in Julia
import Base.show
using Formatting
typealias AA AbstractArray
function xvec!(x, row)
m = length(row)
row[1] = 1
@IshitaTakeshi
IshitaTakeshi / judge_prefix_code.py
Created June 25, 2016 15:46
Judge whether given code is a prefix code or not
from copy import copy
def dangling_suffixes(code1, code2):
def suffixes(code, word):
N = len(word)
s = set()
for c in code:
if c == word:
continue
The MIT License (MIT)
Copyright (c) 2016 Ishita Takeshi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@IshitaTakeshi
IshitaTakeshi / error_correction.jl
Last active December 4, 2016 14:44
Error correction algorithm of the linear code
using DataStructures
function int_to_binarray(number, array_length)
"""
Convert the given number into a fixed length binary array
"""
binstring = bin(number)
# padding for alignment of the lengths of vectors