Skip to content

Instantly share code, notes, and snippets.

@kmakita13714
kmakita13714 / gist:c9571e2c661f0624b1f3fbce8764573f
Created June 28, 2017 01:41
[ブックマークレット] Google Chartを利用して入力したURLのQRコードを表示する
javascript:(function(){url=window.prompt('QRコードにしたいURLをフルパスで入力してね。','http://');if(url!=null&&url!=""){open_url='https://chart.googleapis.com/chart?chs=320x320&cht=qr&chl='+encodeURIComponent(url);location.href=open_url;}})()
@kmakita13714
kmakita13714 / gist:dc440d15e69d73b186169ce971d63e74
Last active June 28, 2017 01:36
Androidのデバッグをコマンドラインから起動する
1. アプリをデバッグ有効で起動させます
adb shell am start -n “[パッケージ名]/[Activity名]" -D
2. 起動したアプリのプロセスIDを確認する
adb jdwp
3. プロセスIDとTCPポートを関連付ける
adb forward tcp:8000 jdwp:5718
※「5718」は2番で実行した結果の値です
@kmakita13714
kmakita13714 / gist:8e5b5315c9453f5e607868c02df1edcf
Created June 15, 2017 06:48
[ブックマークレット] 選択した単語や入力した単語をWeblioの英和辞典・和英辞典で検索する
javascript:(function(){x=document;y=window;if(x.selection){query=x.selection.createRange().text;}else if(y.getSelection){query=y.getSelection();}else if(x.getSelection){query=x.getSelection();};query=window.prompt('検索したい単語を入力してね',query);if(query!=null&&query!=""){window.open('http://ejje.weblio.jp/content/'+encodeURIComponent(query),'_blank','');}})();
@kmakita13714
kmakita13714 / gist:3b8e8d4bf11eff27996e915f3e4608c3
Created June 13, 2017 11:31
[便利なワンライナー・シリーズ] 3桁の数字のフォルダを作成するシェルスクリプト
for i in `seq -f %03g 1 371`; do mkdir $i; done
@kmakita13714
kmakita13714 / gist:4e6bb745fae32984efa9
Last active October 6, 2015 02:32
graphicsmagickを利用して、@3xの画像ファイルから@2xの画像ファイルを生成するワンライナー
for filename in $(ls *@3x.*); do echo $filename; newFilename=`echo $filename | sed -e 's/@3x/@2x/'`; WIDTH=`gm identify -format "%w" $filename`; (( NEW_WIDTH = $WIDTH / 3 * 2 )); HEIGHT=`gm identify -format "%h" $filename`; (( NEW_HEIGHT = $HEIGHT / 3 * 2 )); echo "${WIDTH}x${HEIGHT}"; echo "${NEW_WIDTH}x${NEW_HEIGHT}"; gm convert -resize "${NEW_WIDTH}x${NEW_HEIGHT}" -unsharp 2x1.4+0.5+0 -quality 100 $filename $newFilename; echo 'done!'; done
@kmakita13714
kmakita13714 / SimpleNetLogger.m
Last active August 29, 2015 14:09
[iOS] App ExtensionsからNetwork経由でLogを送る
+ (void)sendNetLoggerWithSession:(NSURLSession *)urlSession message:(NSString *)message
{
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.dateFormat = @"yyyy-MM-dd HH:mm:ss (A)";
NSString *sendMessage = [NSString stringWithFormat:@"%@ %@", [dateFormatter stringFromDate:[NSDate date]], message];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://192.168.64.28/"]];
request.HTTPMethod = @"POST";
request.HTTPBody = [sendMessage dataUsingEncoding:NSUTF8StringEncoding];
@kmakita13714
kmakita13714 / gist:949655ac5e2608b78474
Created May 30, 2014 02:27
SLRequestでTwitterのStreaming APIを利用する方法
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]) {
ACAccountStore *accountStore = [[ACAccountStore alloc] init];
ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
__weak typeof(self) weakSelf = self;
[accountStore requestAccessToAccountsWithType:accountType
options:nil
completion:^(BOOL granted, NSError *error) {
if (granted) {
NSArray *accountArray = [accountStore accountsWithAccountType:accountType];
@kmakita13714
kmakita13714 / init.el
Created April 17, 2013 16:23
私が、Emacs24で利用しているフォントの設定です。 日本語フォントは「Takaoゴシック」を、ASCIIフォントは「Source Code Pro」を利用しています! Source Code Proは、見やすくていいと思います!!
(when (>= emacs-major-version 24)
;; フォントセットを作る
(let* ((fontset-name "myfonts") ; フォントセットの名前
(size 14) ; ASCIIフォントのサイズ [9/10/12/14/15/17/19/20/...]
(asciifont "Source Code Pro") ; ASCIIフォント
(jpfont "Takaoゴシック") ; 日本語フォント
(font (format "%s-%d:weight=normal:slant=normal" asciifont size))
(fontspec (font-spec :family asciifont))
(jp-fontspec (font-spec :family jpfont))
(fsn (create-fontset-from-ascii-font font nil fontset-name)))
@kmakita13714
kmakita13714 / init.el
Created March 18, 2013 12:44
Emacsのモードラインに、日付と時間を表示する設定です。
;; 以下の書式に従ってモードラインに日付・時刻を表示する
(setq display-time-string-forms
'((format "%s/%s/%s(%s) %s:%s" year month day dayname 24-hours minutes)
load
(if mail " Mail" "")))
;; 時刻表示の左隣に日付を追加。
(setq display-time-kawakami-form t)
;; 24時間制
(setq display-time-24hr-format t)