Skip to content

Instantly share code, notes, and snippets.

@mia-0032
mia-0032 / 04_linear.py
Created August 29, 2013 13:47
Python + PypeRでPythonからRをつかってみる
# -*- coding:utf-8 -*-
import numpy
import pandas
import pylab
import pyper
n = 200
# データの生成
score_x = numpy.random.normal(171.77, 5.54, n)
# -*- coding: utf-8 -*-
# 標準入力から各種値の取得
n, d = raw_input().split(' ')
n, d = int(n), int(d)
items = {}
for i in range(0, n):
item = int(raw_input())
if item in items:
@mia-0032
mia-0032 / ec-campaign.java
Created December 8, 2013 15:07
https://paiza.jp/poh/ec-campaign に向けて最初書いていたJavaバージョン。 テストケース2までしかクリアできなかった。
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
@mia-0032
mia-0032 / serialized_float.php
Created December 23, 2013 14:05
Serializeと小数
<?php
/**
* 割り切れるとき
*/
$decimal = 1/10;
echo $decimal . PHP_EOL;
//0.1と表示される
@mia-0032
mia-0032 / file_get_contents_options.php
Last active January 1, 2016 05:19
file_get_contentsのちょっとしたオプション
<?php
$url = '適当なURL';
$data = array(
'hoge' => 'foo'
);
//file_get_contentsの設定
$options = array(
@mia-0032
mia-0032 / datetime_test.php
Created December 23, 2013 14:47
DateTimeクラスを触ってみた
<?php
//現在時刻を取得
$now = new DateTime('now');
//Mysqlのdatetime形式で出力してみたり
echo $now->format('Y-m-d H:i:s');
echo "<hr><br>";
//UNIXタイムでインスタンスを作るときは@をつける
@mia-0032
mia-0032 / string_util.cpp
Created July 27, 2014 11:17
mbed用の文字列加工関数
#include <string>
#include <list>
// 文字列strからstart_strとend_strで囲まれた部分を抽出する。
string match_slice(string str, string start_str, string end_str)
{
int start_pos = str.find(start_str);
int end_pos = str.rfind(end_str);
return str.substr(start_pos + 1, end_pos - start_pos - 1);
}
@mia-0032
mia-0032 / nicovideo_category_recent_videos_mbed.cpp
Last active August 29, 2015 14:05
ニコニコ動画新着動画表示器
#include "mbed.h"
#include "EthernetInterface.h"
#include "GraphicOLED.h"
#include <string>
const string SERVER_HOST = "your-app.herokuapp.com";
const int SERVER_PORT = 80;
const int CATEGORY_NUM = 28;
const string NICO_CATEGORIES[CATEGORY_NUM] = {
@mia-0032
mia-0032 / error.log
Created September 11, 2016 15:27
fluentd v0.14のエラーログ
/path/to/fluent-plugin-gcloud-pubsub/vendor/bundle/ruby/2.3.0/gems/fluentd-0.14.6/lib/fluent/plugin/storage_local.rb:59:in `configure': implement this feature later with system_config (NotImplementedError)
from /path/to/fluent-plugin-gcloud-pubsub/vendor/bundle/ruby/2.3.0/gems/fluentd-0.14.6/lib/fluent/plugin_helper/storage.rb:62:in `storage_create'
from /path/to/fluent-plugin-gcloud-pubsub/vendor/bundle/ruby/2.3.0/gems/fluentd-0.14.6/lib/fluent/plugin/in_dummy.rb:67:in `configure'
from /path/to/fluent-plugin-gcloud-pubsub/vendor/bundle/ruby/2.3.0/gems/fluentd-0.14.6/lib/fluent/root_agent.rb:237:in `add_source'
from /path/to/fluent-plugin-gcloud-pubsub/vendor/bundle/ruby/2.3.0/gems/fluentd-0.14.6/lib/fluent/root_agent.rb:95:in `block in configure'
from /path/to/fluent-plugin-gcloud-pubsub/vendor/bundle/ruby/2.3.0/gems/fluentd-0.14.6/lib/fluent/root_agent.rb:92:in `each'
from /path/to/fluent-plugin-gcloud-pubsub/vendor/bundle/ruby/2.3.0/gems/fluentd-0.14.6/lib/fl
<div class="share">
<ul>
<!-- はてなブックマーク -->
<li class="share-hatena">
<a href="http://b.hatena.ne.jp/add?mode=confirm&url={Permalink}&title={Title}" target="_blank"><i class=" blogicon-bookmark"></i></a>
</li>
<!-- Twitter -->
<li class="share-twitter">
<a href="https://twitter.com/intent/tweet?text={Title}&url={Permalink}&hashtags=はてなブログ" target="_blank"><i class="fa fa-twitter-square" aria-hidden="true"></i></a>
</li>