Skip to content

Instantly share code, notes, and snippets.

View masahitojp's full-sized avatar
🎯
Focusing

Masato Nakamura masahitojp

🎯
Focusing
View GitHub Profile
package example;
/*
* Copyright 2014 Nakamura Masato
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@masahitojp
masahitojp / main.go
Created January 27, 2015 15:44
parindromeかを判定する関数を複数パターン作って、一番早い書き方を調査
package main
import "unicode/utf8"
func Reverse(s string) string {
runes := []rune(s)
for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
runes[i], runes[j] = runes[j], runes[i]
}
return string(runes)
import scala.annotation.tailrec
// scomb.scala
object Scomb extends App {
private def combSort(a: Array[String]):Array[String] = {
@tailrec
def combSortTail(res: Array[String])(len: Int)( gap: Int = len) : Array[String] = {
val ng = 10 * gap / 13 match {
case 9 | 10 => 11
Definition plus n m := n + m.
Definition id (A: Type)(x : A) :A := x.
Definition prop0 : forall(A : Prop), A -> A := fun A x => x.
Definition prop1 : forall (A B C : Prop), (B -> C) -> (A -> B) -> (A -> C) :=
fun A B C f g x => f (g x).
(* 問0. 任意の命題 A B に対して、A ならば 「A ならば B」ならば Bが成り立つ。*)
Definition prob0 : forall (A B : Prop) , A -> (A -> B) -> B :=
fun A B f g => g f.
@masahitojp
masahitojp / gist:e5a87e9984c6a48fbcd5
Last active August 29, 2015 14:19
centos6-oraclejdk6-ant
FROM centos:centos6
MAINTAINER Masato NAKAMURA "randomstep@gmail.com"
# Download Java 6 from the Oracle site and Install
# We are chaining all these commands to reduce the size of the image
# it does unfortunately make it less readable so i try to explain each step:
# 1. download/install wget
# 2. pull down the Oracle Java 6 rpm bin file using wget
# 3. change permissions on the download bin file to make it executable
# 4. extract the bin file into an rpm
package me.masahito
class BranchTest extends org.scalatest.FunSuite {
val leaf1 = Leaf(new IroIroInfo(1,1))
val leaf2 = Leaf(new IroIroInfo(1,2))
val leaf3 = Leaf(new IroIroInfo(1,3))
val leaf4 = Leaf(new IroIroInfo(1,4))
val leaf5 = Leaf(new IroIroInfo(1,5))
val leaf6 = Leaf(new IroIroInfo(1,6))
'hubot --create' is deprecated. Use the yeoman generator instead:
npm install -g yo generator-hubot
mkdir -p bot
yo hubot
See https://github.com/github/hubot/blob/master/docs/README.md for more details on getting started.
@masahitojp
masahitojp / cpufreq.py
Last active August 29, 2015 14:22
http://ssig33.com/text/VAIO%20Pro%20%E3%82%92%20Linux%20%E3%81%A7 これを参考にpython2/3で動くように書き直し
#! /usr/bin/python
import argparse
import glob
import os
import sys
parser = argparse.ArgumentParser()
parser.add_argument("mode")
args = parser.parse_args()
// ==UserScript==
// @name googleMemorize
// @namespace http://passion.s25.xrea.com/
// @description 前回検索した単語を検索テキストボックスに表示します。
// @include http://www.google.co.jp/*
// @include http://www.google.com/*
// ==/UserScript==
(function(){
/*関数定義*/
// 検索単語を保存
// ==UserScript==
// @include http://api.wassr.jp/statuses/update.json
// ==/UserScript==
location.href='http://wassr.jp/my/'