Skip to content

Instantly share code, notes, and snippets.

View dealforest's full-sized avatar

Toshihiro Morimoto dealforest

View GitHub Profile
@dealforest
dealforest / gist:3987175
Created October 31, 2012 14:00
ActiveRecord exexute sample
/* データ
> select * from hoge;
+------+------+
| fuga | foo |
+------+------+
| 1 | 2 |
| 3 | 4 |
| 5 | 6 |
+------+------+
*/
define pv
if $argc == 0
po [[[UIApplication sharedApplication] keyWindow] recursiveDescription]
end
if $argc == 1
po [$arg0 recursiveDescription]
end
end
define st
#!/bin/bash -eu
temp_dir=`mktemp --directory`
target_dir=/Applications/Xcode-beta.app/Contents/MacOS
if [ -e $target_dir/Xcode.signed ]; then
echo "already exists Xcode.signed"
exit 1
fi
@dealforest
dealforest / slack.py
Last active January 24, 2018 01:53
send to slack in LLDB
#!/usr/bin/env python
import lldb
def slack(debugger, command, result, internal_dict):
frame = lldb.debugger.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
path = command
lldb.debugger.HandleCommand("""
expr -l swift --
@dealforest
dealforest / post-checkout
Last active October 10, 2018 15:10
When you switch branch, run the `pod install`. install to `path/to/.git/hooks/`
#!/bin/sh
set -e
prev="$1"
new="$2"
branch_switch="$3"
if [ -z "$branch_switch" ] || [ $branch_switch -eq 0 ]; then
exit 0 # this was a file checkout
@dealforest
dealforest / MnistImageType.swift
Last active January 14, 2020 03:33
the model automatically generated from mlmodel
//
// MnistImageType.swift
//
// This file was automatically generated and should not be edited.
//
import CoreML
/// Model Prediction Input Type
@dealforest
dealforest / AES256Cipher.java
Created March 1, 2012 13:39
AES256 encryption on Android
package net.dealforest.sample.crypt;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.security.InvalidKeyException;