Skip to content

Instantly share code, notes, and snippets.

View a-yasui's full-sized avatar
🐆
にゃおす

a.yasui a-yasui

🐆
にゃおす
View GitHub Profile
@a-yasui
a-yasui / shiritori.scala
Created April 13, 2013 09:49
たかし君からの問いかけ、その2
/**
* http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0225
*
* 回文問題
*
* #scala_kansai_beginners
*/
var buff = List(
"apple",
@a-yasui
a-yasui / gist:5282873
Created April 1, 2013 02:19
XDebug with sublime text 2
メモ書き
----------
Xdebug:
------
Xdebug 2012.06.13 Changelog
===========================
@a-yasui
a-yasui / form.php
Created February 10, 2013 16:12
サーミスタとEthernetを使ったテスト
<?php
$form = "";
function write ($temp) {
$path = "temp.txt";
$fp = fopen($path, "a");
if ($fp) {
$time = time();
fwrite($fp, "$time\t$temp\n");
fclose($fp);
@a-yasui
a-yasui / gist:4585010
Created January 21, 2013 10:05
Project Euler Problem 1 Erlang...
1> lists:sum([X || X <- lists:seq(1, 999), X rem 3 == 0 orelse X rem 5 == 0]).
233168
@a-yasui
a-yasui / MAMPcwd
Last active December 9, 2015 20:28 — forked from anonymous/gist:4323676
MAMP subtool コマンドラインで DocumentRoot を現在の作業ディレクトリに変更して再起動します # 間違ってanonymousで書いてもうたよ…
#!/bin/sh
# -*- coding: utf_8 -*-
#
# MAMPcwd (start|stop|cwd)
# MAMP のコマンドライン補佐ツール
#
# start: 再起動/起動をします
# stop : 停止します
# cwd : コマンドを実行したディレクトリをDocumentRootにして、再起動をします
#
@a-yasui
a-yasui / for.c
Created November 29, 2012 10:17
C99 for loop
/* gcc -std=c99 -o for for.c
*
* -std=c99 で c99 文法としてコンパイル
* ex: http://seclan.dll.jp/c99d/
*/
#include <stdio.h>
int
main (void)
{
@a-yasui
a-yasui / wareki.py
Created August 9, 2012 09:55
明治元年から平成二十四年までの毎年の日数を出力するプログラム
#!/usr/bin/env python
# -*- coding: utf_8 -*-
def yearToWareki (year):
r"""
result: tuple [('元号', 年, 日数), ('元号', 年, 日数)]
2つ目の要素はほぼないが、変わり目の時にある
"""
# 明治元年: 1868
# 明治45年: 1912 (~7/29)
@a-yasui
a-yasui / cal.py
Created August 9, 2012 09:18
1900年から2010年までのうち、毎年の日数を出力するプログラム
#!/usr/bin/env python
def is_uru (year):
if year % 4 == 0:
if year % 400 == 0:
return True
elif year % 100 == 0:
return False
return True
return False
<html>
<head>
<meta charset="utf-8">
<title></title>
<link href="style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
</head>
<body>
@a-yasui
a-yasui / gist:458c1773087bf31901df
Created June 24, 2015 02:56
oneline mime decode
# `test.txt` という名前の mail から plain text を取り出して吐き出す
msg = email.message_from_string(open('test.txt').read())
for part in msg.walk():
if part.get_content_type() == 'text/plain':
open('test.plan.txt', 'w').write( part.get_payload(decode=1).encode('iso-2022-jp').decode('utf8') )