Skip to content

Instantly share code, notes, and snippets.

View tanishiking's full-sized avatar
🤖

Rikito Taniguchi tanishiking

🤖
View GitHub Profile
@tanishiking
tanishiking / is_alive.sh
Created June 4, 2016 06:08
簡易的なプロセス死活監視スクリプト
#!/usr/bin/sh
process=""
while true; do
is_alive=`ps aux | grep "$process" | grep -v grep | wc -l`
if [[ $is_alive -eq 0 ]]; then
echo "process dead!!!!"
break
fi
Classfile /Users/tanishiking/dev/playground/java/Main.class
Last modified 2016/05/12; size 472 bytes
MD5 checksum 5653395a8fc0c5a01fb59d4bdbe07c00
Compiled from "Main.java"
class Main
minor version: 0
major version: 52
flags: ACC_SUPER
Constant pool:
#1 = Methodref #7.#17 // java/lang/Object."<init>":()V
import numpy as np
import matplotlib
from math import sqrt
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
def binomial_to_normal(samples, trials, probability, bins=50):
data = []
for i in range(samples):
FROM ubuntu:14.04
RUN apt-get update
RUN apt-get install -y software-properties-common
RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449
RUN add-apt-repository "deb http://dl.hhvm.com/ubuntu $(lsb_release -sc) main"
RUN apt-get update
RUN apt-get install -y hhvm
RUN hhvm --version
class hoge:
def __init__(self):
self.a = 1
def __get_a(self):
return self.a
def geta(self):
# 普通に __get_a()にアクセスできる
a = self.__get_a()
return a
object problem50 {
def getMaxSumOfPrimes(limit: Int): Option[Int] = {
// 1000000以下の素数の遅延リスト
lazy val primes: Stream[Int] = Stream.cons(2, Stream.from(3).filter(i => primes.takeWhile(j => j * j <= i).forall(i % _ > 0))).takeWhile(_ <= limit)
def isPrime(num: Int): Boolean = primes.contains(num)
// 素数を小さい順に足していって1000000以下で最大となるまでの素数の遅延リスト
val primeSumLimit: List[Int] = primes.takeWhile(i=> primes.takeWhile(_ <= i).map(_.toLong).sum <= limit).toList
for (span <- primeSumLimit.length to 1 by -1) {
if (primeSumLimit.sliding(span).map(_.sum).exists(isPrime)) {
object LevenshteinDistance {
private def editDistance(str1: String, str2: String): Int = {
val cols: Int = str1.length
val rows: Int = str2.length
val chars1: Array[Char] = str1.toCharArray
val chars2: Array[Char] = str2.toCharArray
val dp = new Array[Array[Int]](rows + 1).map(ys => new Array[Int](cols + 1))
for (row <- 0 to rows) {
dp(row)(0) = row
from sys import maxsize
class Alignmenter(object):
def __init__(self, array1, array2):
self.array1 = array1
self.array2 = array2
self.rows = len(self.array1) + 1
self.cols = len(self.array2) + 1
self.table = []
# -*- coding: utf-8 -*-
from time import sleep
import json
import pickle
import lxml.html
TARGET_URL = 'http://www.kyochari-navi.jp/churin/index.html'
BASE_URL = 'http://www.kyochari-navi.jp/churin/'
scala> 1 :: 2 :: 3 :: Nil
res22: List[Int] = List(1, 2, 3)
scala Stream.cons(1, Stream.cons(2, Stream.cons (3, Stream.empty)))
res23: Stream.Cons[Int] = Stream(1, ?)
scala> 1 #:: 2 #:: 3 #:: Stream.empty
res24: scala.collection.immutable.Stream[Int] = Stream(1, ?)