Skip to content

Instantly share code, notes, and snippets.

View ysugimoto's full-sized avatar
🕘
GMT+9 JST

Yoshiaki Sugimoto ysugimoto

🕘
GMT+9 JST
View GitHub Profile
@ysugimoto
ysugimoto / ellipsis.js
Last active August 29, 2015 14:07
複数行をellipsisする君
(function(global) {
'use strict';
function Ellipsis(element, trail) {
this.element = element;
this.exactHeight = element.offsetHeight;
this.text = element.textContent;
this.textSize = this.text.length;
this.trail = trail || '...';
}

Go 1.4 RC1が出たのでまとめ

原文: http://tip.golang.org/doc/go1.4

Introduction to Go 1.4 より

  • ガベージコレクタを改善したよ
  • go コマンドにいくつかツールが追加されたよ
  • Android, NaCl, AMD64上のPlan9サポートが追加されたよ。互換性も維持するよ
@ysugimoto
ysugimoto / detect_mp4_duration.sh
Created June 24, 2015 11:24
MP4の動画ファイルの再生時間を取得するワンライナー
#!/bin/sh
# http://qiita.com/takashisite/items/0eeb45c8bbd232e915dd
ffmpeg -i movie.mp4 2>&1 | grep "Duration" | cut -d ' ' -f 4 | sed s/,// | sed 's@\..*@@g' | awk '{ split($1, A, ":"); split(A[3], B, "."); print 3600*A[1] + 60*A[2] + B[1] }'
@ysugimoto
ysugimoto / qdmail.php
Last active August 23, 2017 14:11
qdmail for PHP5.3+
<?php
/**
* Qdmail ver 1.2.6b
* E-Mail for multibyte charset
*
* PHP versions 4 and 5 (PHP4.3 upper)
*
* Copyright 2008, Spok in japan , tokyo
* hal456.net/qdmail : http://hal456.net/qdmail/
* & CPA-LAB/Technical : http://www.cpa-lab.com/tech/
@ysugimoto
ysugimoto / setup.sh
Last active March 6, 2020 07:49
set up docker-compose.yml
#!/bin/bash
YOU=`whoami`
CWD=$(cd $(dirname $0);pwd)
# Create mout storage directory if not exists
if [ ! -d "$HOME/perfstore/graphite" ]; then
echo "creating directory: $HOME/perfstore/graphite..."
mkdir -p $HOME/perfstore/graphite
fi
<?php
class GetZoneInfo {
const ORIGIN_SIGNATURE = '$ORIGIN';
const IN_SIGNATURE = 'IN';
const A_RECORD = "A";
const CNAME_RECORD = "CNAME";
protected $fqdnList = [];
@ysugimoto
ysugimoto / ats
Last active July 12, 2016 02:06
Artisan task selector-runner ( Depend peco )
#!/bin/sh
# Artisan ( Laravel's CLI tool ) find-up, selectable runner
# @depend
# peco - https://github.com/peco/peco
PHP=`which php`
CWD=`pwd`
ARTISAN="artisan"
COMMAND=
@ysugimoto
ysugimoto / 0_reuse_code.js
Created October 7, 2016 18:35
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ysugimoto
ysugimoto / npm-run-completion.sh
Created August 21, 2017 07:57
Bash-completion for `npm run` command
#!/bin/bash
# This is bash-completion for 'npm run' command.
# Find up package.json and completion 'npm scripts'.
_npm_run_completion() {
CURRENT="${COMP_WORDS[COMP_CWORD]}"
SUBCOMMAND="${COMP_WORDS[COMP_CWORD-1]}"
if [ "${SUBCOMMAND}" != "run" ]; then
return
fi
@ysugimoto
ysugimoto / generate.sh
Created October 26, 2017 16:53 — forked from shinofara/generate.sh
SSL GENERATE MAC ONLY
#!/bin/bash
set -eu
atexit() {
[[ -n $tmpdir ]] && rm -fr "$tmpdir"
[[ -n $sslconf ]] && rm -fr "$sslconf"
}
tmpdir=`mktemp -d`
sslconf=`mktemp`
trap atexit EXIT
trap 'trap - EXIT; atexit; exit -1' SIGHUP SIGINT SIGTERM