Skip to content

Instantly share code, notes, and snippets.

Avatar
🐆
にゃおす

a.yasui a-yasui

🐆
にゃおす
View GitHub Profile
@a-yasui
a-yasui / php-fpm.conf
Last active August 29, 2015 13:55
Nginx + php-fpm configuration memo
View php-fpm.conf
;;;;;;;;;;;;;;;;;;;;;
; FPM Configuration ;
;;;;;;;;;;;;;;;;;;;;;
[global]
; Pid file
; Note: the default prefix is /home/yasui/.phpenv/versions/5.3.28/var
; Default Value: none
pid = run/php-fpm.pid
; Error log file
@a-yasui
a-yasui / awsinstall.sh
Last active August 29, 2015 14:07
install haskell
View awsinstall.sh
#!/bin/sh
set -x
# set some variables, so they're easy to adjust
TMPDIR=/var/tmp
BOOTSTRAP=/usr/local/hp-bootstrap
# these versions are current as of oct 3, 2014. if a lot of time has
# passed between then and the time you build this, you might want to
# verify they haven't been superseded by newer versions.
View php-fpm.sh
#! /bin/sh
#
# chkconfig: - 84 16
# description: PHP FastCGI Process Manager
# processname: php-fpm
# config: /home/user/.phpenv/versions/5.4.37/etc/php-fpm.conf
# pidfile: /var/run/php-fpm.pid
# this source is https://forums.aws.amazon.com/message.jspa?messageID=283298
#
@a-yasui
a-yasui / gist:458c1773087bf31901df
Created June 24, 2015 02:56
oneline mime decode
View gist:458c1773087bf31901df
# `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') )
View index_test1.html
<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 / cal.py
Created August 9, 2012 09:18
1900年から2010年までのうち、毎年の日数を出力するプログラム
View cal.py
#!/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
@a-yasui
a-yasui / wareki.py
Created August 9, 2012 09:55
明治元年から平成二十四年までの毎年の日数を出力するプログラム
View wareki.py
#!/usr/bin/env python
# -*- coding: utf_8 -*-
def yearToWareki (year):
r"""
result: tuple [('元号', 年, 日数), ('元号', 年, 日数)]
2つ目の要素はほぼないが、変わり目の時にある
"""
# 明治元年: 1868
# 明治45年: 1912 (~7/29)
@a-yasui
a-yasui / for.c
Created November 29, 2012 10:17
C99 for loop
View for.c
/* 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 / MAMPcwd
Last active December 9, 2015 20:28 — forked from anonymous/gist:4323676
MAMP subtool コマンドラインで DocumentRoot を現在の作業ディレクトリに変更して再起動します # 間違ってanonymousで書いてもうたよ…
View MAMPcwd
#!/bin/sh
# -*- coding: utf_8 -*-
#
# MAMPcwd (start|stop|cwd)
# MAMP のコマンドライン補佐ツール
#
# start: 再起動/起動をします
# stop : 停止します
# cwd : コマンドを実行したディレクトリをDocumentRootにして、再起動をします
#
@a-yasui
a-yasui / gist:4585010
Created January 21, 2013 10:05
Project Euler Problem 1 Erlang...
View gist:4585010
1> lists:sum([X || X <- lists:seq(1, 999), X rem 3 == 0 orelse X rem 5 == 0]).
233168