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 / loop_reader.php
Last active December 19, 2015 05:08
AMQP/RabbitMQ めも
<?php
/** 兎に角ループさせる */
while (true) {
echo " [x] If you wanna stop, you push Ctrl-C","\n";
require("reader.php");
sleep(1);
}
@a-yasui
a-yasui / PHP53.log
Created October 17, 2013 03:53
PHP5.5/PHP5.3 にて、連想配列とSwitchのパフォーマンス比較。結果的にはswitchの方が速く、PHP55の方が速いですよっと。
$ /usr/local/Cellar/php53/5.3.27/bin/php switch_or_array.php
start arr ... Finish: 10.038110971451
start sw ... Finish: 6.0564711093903
@a-yasui
a-yasui / httpd.conf
Last active December 28, 2015 20:29
MAMP.cwd の brew apache2 バージョン
# /usr/local/Cellar/etc/apache2/httpd.conf
ServerRoot "/usr/local/Cellar/httpd/2.2.25"
Listen 8888
LoadModule authn_file_module libexec/mod_authn_file.so
LoadModule authn_dbm_module libexec/mod_authn_dbm.so
LoadModule authn_anon_module libexec/mod_authn_anon.so
LoadModule authn_dbd_module libexec/mod_authn_dbd.so
LoadModule authn_default_module libexec/mod_authn_default.so
LoadModule authz_host_module libexec/mod_authz_host.so
LoadModule authz_groupfile_module libexec/mod_authz_groupfile.so
@a-yasui
a-yasui / php-fpm.conf
Last active August 29, 2015 13:55
Nginx + php-fpm configuration memo
;;;;;;;;;;;;;;;;;;;;;
; 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
#!/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.
#! /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
# `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') )
@a-yasui
a-yasui / gist:7940da69a17ce385a43a4cd0a1d26846
Created October 17, 2016 02:11
psコマンドで表示されるメモリー容量を、MB単位で表示
#!/bin/sh
ps uax | awk 'BEGIN{FS=" ";OFS="\t";}{print $1,$2,$3,$4,$5,$6/1024 " MB",$7,$8,$9,$10,$11;}'
@a-yasui
a-yasui / log.py
Created October 18, 2016 03:05
logger の設定テンプレ
#!/usr/bin/env python
import logging
from logging import getLogger, StreamHandler, DEBUG
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s (%(threadName)-10s) %(levelname)s %(message)s")
logger = getLogger(__name__)
handler = StreamHandler()
@a-yasui
a-yasui / test.swift
Created December 21, 2016 04:04
リンク入りテキストを全部オレンジ色にしたいだけのコード。期待通り動かない泣きたい
class ViewController: NSViewController
{
func load(){
let attributeText = NSMutableAttributedString(string: "テスト")
let field = NSTextField(frame: NSRect(x: 0, y: 0, width: 30, height: 30))
let attr = [
NSLinkAttributeName: "https://google.com/",
] as [String : Any]