Skip to content

Instantly share code, notes, and snippets.

View ikait's full-sized avatar

Taishi Ikai ikait

View GitHub Profile
@ikait
ikait / pw.sh
Created April 26, 2013 09:03
Parallels をわりと簡単にコマンドから使う
#!/bin/bash
name=`basename $0`
prlctl list --info "${1}" > /dev/null
if [ "$?" -eq 0 ] ; then
os="$1"
id=`prlctl snapshot-list "${os}" | grep -oE '\*{.*\}' | tr -d '*{}'`
action="$2"
@ikait
ikait / index.html
Created May 26, 2013 03:27
タブ切り替えビュー (jQueryプラグイン版 ・タブ切り替え用のカスタムイベントを作って、triggerで動かす。
<!doctype html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css">
<script src="jquery-1.10.0.js"></script>
<script src="jquery.tabs.js"></script>
<script>
$(function () {
$("nav").tabs({
@ikait
ikait / connect-afp.applescript
Created May 26, 2013 03:34
NASにいっぺんに接続するためのAppleScript
set ssid to (do shell script "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport --getinfo")
if ssid contains "家のSSID" then
tell application "Finder"
delay 10
mount volume "afp://サーバのアドレス/ディレクトリ(任意)"
-- 複数マウントしたいときは上の行をコピペして増やす
end tell
end if
@ikait
ikait / zipit.sh
Created August 14, 2014 04:00
引数で指定したファイル/ディレクトリを、<オリジナルに現在の日時の14桁を付加したファイル名>.zipにzipする
function zipit() {
string_dirpath=$(cd `dirname $1` > /dev/null && pwd)
string_filepath=${string_dirpath}/`basename $1`
echo "Attempt to zip \"${string_filepath}\""
if [ -e $string_filepath ] ; then
echo "It exists!"
string_filename=`basename $1`
date=`date +"%Y%m%d%H%M%S"`
@ikait
ikait / custom-sf.css
Last active September 22, 2016 08:02
Mac の Web ブラウザ (Chrome, Safari) などで、 iOS のようなフォント表示を実現するユーザースタイルシート
/**
* iOS 10〜
* San Francisco, ヒラギノの組み合わせ
*/
@charset "utf-8";
textarea {
font-family: monospace;
}
@ikait
ikait / convert_to_webp
Created May 20, 2015 05:33
cwebp を使ってディレクトリ内の画像ファイルを webp に変換する。クオリティ (-1) は 10 から 5 刻みで 60 まで。
#!/usr/local/bin/bash
for i in {10..60..5}
do
echo "---------------------------------------------"
echo "[start] rate: $i %"
echo "---------------------------------------------"
find . -name "*.png" -print0 | xargs -0 -I{} cwebp -q $i {} -o {}-$i.webp
echo "---------------------------------------------"
echo "[finish] rate: $i % "
@ikait
ikait / gist:50665efec3f63a28da41
Created May 20, 2015 05:35
pyssim で変換する。ファイル名も出せるように
#!/bin/bash
function cmp_ssim() {
echo $1
pyssim $1 $2
}
cmp_ssim $1 $2
@ikait
ikait / index.js
Created July 4, 2015 11:48
AWS Lambda で WebP変換
'use strict';
// 全体の設定
var DST_BUCKET = 'xxxxxxxxxxx'; // WebP が格納されるバケット
var SRC_BUCKET = 'xxxxxxxxxxx'; // イベントソース
var ACCESS_KEY = 'XXXXXXXXXXXXXXXXXXXX'; // アクセスキーID
var SECRET_KEY = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; // シークレットキー
var REGION = 'ap-northeast-1'; // リージョン
var ACCEPTED_EXTENTIONS = ["png", "jpg", "gif"]; // 拡張子
@ikait
ikait / qiita_custom.css
Last active October 1, 2015 02:14
Qiita:team のカラーを排してスッキリさせる css
body {
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
}
a {
color: #4078c0;
}
a:hover, a:focus {
@ikait
ikait / backlog_custom.css
Last active October 1, 2015 02:15
Backlog の文字サイズを大きくして、カラーも排してスッキリさせる
.loom {
font-size: 100%;
line-height: 1.8;
}
#wikicard {
padding: 0;
border: none;
background-color: transparent;
margin-top: -30px;