Skip to content

Instantly share code, notes, and snippets.

Avatar
🐆

a.yasui a-yasui

🐆
View GitHub Profile
@a-yasui
a-yasui / installer.sh
Last active Dec 31, 2018
install PHPEnv + PHP7.2 + MySQL8 in CentOS7
View installer.sh
#!/usr/bin/env bash
# see: https://qiita.com/a_yasui/items/40ec1c30afc9f90acd0e
PHP_VERSION=7.2.13
INSTALL_DIR=/opt/phpenv
MYSQL_YUM_REPOSITORY_RPM=https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
MY_CNF=https://gist.githubusercontent.com/a-yasui/9b3a185f2920e5f1bfd0dbba10aa2261/raw/6a5ec116dc6295aeeda1ca3599fe11da687e1bb3/my.cnf
# 必要なものをインストール
@a-yasui
a-yasui / script_dir.sh
Last active Apr 3, 2020
Work directory moving
View script_dir.sh
#!/usr/bin/env bash
# スクリプトの設置ディレクトリに移動して、そのディレクトリパスを取得する
# :-$0 とする事で他のshellでも動くようになる
PWD="$( cd "$( dirname "${BASH_SOURCE:-$0}" )" && pwd )"
@a-yasui
a-yasui / convert.php
Created Aug 30, 2017
Video IndexerのJSONファイルをWebVTTに書き出すスクリプト
View convert.php
<?php
/**
* php ./convert.php -f <json file>
*/
/**
* Class Block
*/
class Block
{
/**
@a-yasui
a-yasui / test.swift
Created Dec 21, 2016
リンク入りテキストを全部オレンジ色にしたいだけのコード。期待通り動かない泣きたい
View test.swift
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]
@a-yasui
a-yasui / log.py
Created Oct 18, 2016
logger の設定テンプレ
View log.py
#!/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 / gist:7940da69a17ce385a43a4cd0a1d26846
Created Oct 17, 2016
psコマンドで表示されるメモリー容量を、MB単位で表示
View gist:7940da69a17ce385a43a4cd0a1d26846
#!/bin/sh
ps uax | awk 'BEGIN{FS=" ";OFS="\t";}{print $1,$2,$3,$4,$5,$6/1024 " MB",$7,$8,$9,$10,$11;}'
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 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 / awsinstall.sh
Last active Aug 29, 2015
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.
@a-yasui
a-yasui / php-fpm.conf
Last active Aug 29, 2015
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