Skip to content

Instantly share code, notes, and snippets.

View ikait's full-sized avatar

Taishi Ikai ikait

View GitHub Profile
#coding: utf-8
import json
from flask import jsonify
import requests
APPLE_DEVICE_LIST_URL = "https://raw.githubusercontent.com/pbakondy/ios-device-list/master/devices.json"
apple_device_list = []
def apple_devices(request):
"""Return apple device info.
@ikait
ikait / broom.sh
Created December 3, 2016 05:13
Cleanup logs Lambda output on CloudWatch
#!/bin/bash
remove_log_streams() {
LOG_GROUP_NAME=("$1")
LOG_STREAMS=("$2")
PROFILE=("$3")
for LOG_STREAM in ${LOG_STREAMS[@]}; do
LOG_STREAM=${LOG_STREAM//\"/} # remove double quotes which are added by jq
echo "Delete $LOG_GROUP_NAME: $LOG_STREAM"
aws logs \
@ikait
ikait / yakumono.js
Created February 22, 2016 15:02
全角/半角約物処理
var MK = "{[「『(⦅〈《〔〘【〖";
var AK = "}]」』)⦆〉》〕〙】〗";
var KT = "、,。.";
var regexpMK = new RegExp("(.{1})([" + MK + "])", "g");
var regexpAK = new RegExp("([" + AK + "])(.{1})", "g");
var regexpKT = new RegExp("[" + KT + "]", "g");
document.addEventListener("DOMContentLoaded", function () {
var body = document.getElementsByTagName("body")[0];
@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;
@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 / 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 / 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 / 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 / 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 / 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"`