Skip to content

Instantly share code, notes, and snippets.

View hidekuro's full-sized avatar
🏠
Working from home

hidekuro

🏠
Working from home
View GitHub Profile
@hidekuro
hidekuro / office_stealth.css
Last active November 18, 2015 01:42
office stealth style for Stylish(ChromeExtension)
* {
background-color: #fff !important;
background-image: none !important;
border-color: #fff !important;
color: #ddd !important;
font-size: 12px !important;
font-family: "Hiragino Kaku Gothic Pro W3", "ヒラギノ角ゴ Pro W3", "Meiryo", "メイリオ", "Noto Sans Japanese Regular", sans-serif !important;
text-decoration: none !important;
}
@hidekuro
hidekuro / cvsadduser.pl
Created March 28, 2013 02:32
高林哲さん( http://0xcc.net/ )の cvsadduser.pl 保管用。
#!/usr/bin/perl -w
#
# cvsadduser - a tool to generate a passwd entry for CVS pserver.
#
# Copyright (C) 1999 Satoru Takabayashi <satoru-t@is.aist-nara.ac.jp>
# All rights reserved.
# This is free software with ABSOLUTELY NO WARRANTY.
#
# You can redistribute it and/or modify it under the terms of
# the GNU General Public License version 2.
@hidekuro
hidekuro / Android.checkstyle.xml
Last active December 16, 2015 06:49
Androidコードスタイルガイドラインに沿ったEclipse設定
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<!--
This configuration file was written by the eclipse-cs plugin configuration editor
-->
<!--
Checkstyle-Configuration: Android
Description:
http://source.android.com/source/code-style.html
@hidekuro
hidekuro / MyClass.java
Last active December 17, 2015 12:39
一般的なアプリ開発において、型引数にした型のClassオブジェクトを取得したり、 インスタンス化したりしたくなった場合、設計を疑うべきであるという前提のもと、 一般的ではない特殊なケースにおいて型引数のClassオブジェクトを特定する方法。 可変長引数を省略した場合、実装側には長さ0の配列が渡されることを利用する。 via http://d.hatena.ne.jp/language_and_engineering/20120502/p1 via http://d.hatena.ne.jp/Nagise/20100202/1265131791
public class MyClass<T> {
private Class<T> typeParamClass;
// このメソッドを引数なしで呼び出すと型が解決される
public void resolveTypeParamClass(T... t) {
@SuppressWarnings("unchecked")
Class<T> clazz = (Class<T>) t.getClass().getComponentType();
this.typeParamClass = clazz;
}
@hidekuro
hidekuro / RegAddAutorun.bat
Created May 23, 2013 03:37
実行したユーザの環境において、%UserProfile%直下にautorun.cmdが あれば、コマンドプロンプトの起動時に実行するようにするレジストリ登録のワンライナー。 http://goo.gl/V7QrQ
reg add "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor" /v AutoRun /d "@ECHO OFF & IF EXIST \"%HOMEDRIVE%%HOMEPATH%\autorun.cmd\" \"%HOMEDRIVE%%HOMEPATH%\autorun.cmd\" & ECHO ON"
@hidekuro
hidekuro / ios_app_archive.sh
Created November 26, 2013 06:53
ryo_abe氏作、Archive作業を自動化するシェルスクリプト。 http://d.hatena.ne.jp/ryo_abe/20120226/1330242142
#!/bin/sh
#SDK
SDK="iphoneos5.0"
# コンフィグレーション(「Debug」、「Release」、「Ad hoc」)
CONFIGURATION="Release"
# Xcodeのプロジェクト名
PROJ_FILE_PATH="hoge.xcodeproj"
@hidekuro
hidekuro / check_required_vars.sh
Created January 25, 2016 09:47
複数の変数名の変数値存在チェックを行うBashスクリプト断片
#!/bin/bash
# required variables
required_vars=("FOO" "BAR" "BAZ")
# check defined
for VAR_NAME in "${required_vars[@]}"; do
eval var_temp='$'$VAR_NAME
if [[ -z "$var_temp" ]]; then
echo "$VAR_NAME is undefined." 1>&2
@hidekuro
hidekuro / parse_args_sample.sh
Created January 29, 2016 22:16
bash引数解析サンプル
declare -i argc=0
declare -a argv=()
while (( $# > 0 )); do
case "$1" in
- | -- )
shift
argc+=$#
argv+=("$@")
break
;;
@hidekuro
hidekuro / elb_update_cert.sh
Last active June 7, 2017 09:09
Let's Encryptで証明書を取得してIAMにアップロードし、ELBに設定するスクリプト。
#!/bin/bash
set -e
cd $(dirname $0)
# 現在日付のYYYYMMDD
DATE_CURRENT_YMD=$(date '+%Y%m%d')
# AWS Profile 名
AWS_PROFILE=elb_update_cert
@hidekuro
hidekuro / ValidatableModelBase.cs
Last active October 27, 2017 05:27
INotifyDataErrorInfoをサポートするBindableBase
/// <summary>
/// INotifyDataErrorInfoをサポートするBindableBase
/// </summary>
class ValidatableModelBase : BindableBase, INotifyDataErrorInfo
{
private ErrorsContainer<string> _errors;
public event EventHandler<DataErrorsChangedEventArgs> ErrorsChanged;
public IEnumerable GetErrors(string propertyName)