Skip to content

Instantly share code, notes, and snippets.

@hkurosawa
hkurosawa / util.gs
Last active October 31, 2020 07:54
Google App Scriptを使ってスプレッドシートに任意のkey-valueを保存する
/**
* 任意のシートにkey-valueを保存する
*/
class Variables{
constructor (sheet_name="variables") {
let app = SpreadsheetApp.getActiveSpreadsheet();
this.sheet = app.getSheetByName(sheet_name);
if (!this.sheet) {
//シートが存在しない場合は末尾に追加
app.insertSheet(sheet_name, app.getSheets().length);
@hkurosawa
hkurosawa / gist:2049459
Created March 16, 2012 10:23
Playing sound file in assets folder on Android
import android.media.MediaPlayer;
public class PlayerExample {
MediaPlayer p = null;
private void playSound(String fileName) {
p = new MediaPlayer();
try {
AssetFileDescriptor afd = ctx.getAssets().openFd(fileName);
p.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
afd.close();
@hkurosawa
hkurosawa / gist:1822617
Created February 14, 2012 02:22
Adding Admob banner to PhoneGap App
public class PhonegapWithAdmobActivity extends DroidGap {
private AdView adView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
adView = new AdView(this, AdSize.BANNER, PUBLISHER_ID);
super.loadUrl("file:///android_asset/www/index.html");
((LinearLayout)appView.getParent()).addView(adView);
adView.loadAd(new AdRequest());
}
@hkurosawa
hkurosawa / gist:3566e602348d1ff2e529a79679e6653c
Last active December 24, 2017 16:30
requirements-for-data-analytics.txt
jupyter==1.0.0
pandas==0.21.1
seaborn==0.8.1
lxml==4.1.1
html5lib==1.0.1
beautifulsoup4==4.6.0
requests==2.18.4
@hkurosawa
hkurosawa / gist:c25f987c144c66f40417
Last active February 9, 2017 00:28
Cocos2d-x 3.2 .gitignore
# osx - https://github.com/github/gitignore/blob/master/Global/OSX.gitignore
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
@hkurosawa
hkurosawa / gist:7593622
Last active December 29, 2015 01:29
# searches launchd.plist files from launchd directories
#!/bin/bash
# searches launchd.plist files from launchd directories
grep `launchctl list | grep $1 | cut -f 3` ~/Library/LaunchAgents/* /Library/LaunchAgents/* /Library/LaunchDaemons/* /System/Library/LaunchAgents/* /System/Library/LaunchDaemons/* | cut -d ':' -f 1 | uniq
@hkurosawa
hkurosawa / .zshrc
Created November 16, 2012 11:22
my .zshrc file
autoload -U compinit
autoload colors
compinit
colors
PS1="%{${fg[green]}%}${USER}@${HOST%%.*}:%~ [%D{%y-%m-%d %H:%m:%S}]%{${reset_color}%}
[%!]%(!.#.$) "
PATH=$PATH:/usr/local/bin/
alias ls="ls -G"
@hkurosawa
hkurosawa / gist:3383994
Created August 18, 2012 02:29
automator script to install apk
ADB_PATH=PATH_TO_ADB
for f in "$@"
do
$ADB_PATH install -r "$f"
done
@hkurosawa
hkurosawa / gist:2420936
Created April 19, 2012 13:18
toggle Finder setting to show hidden files
#!/bin/bash
#toggle OSX Finder setting to show the hidden dotfiles
if [ `defaults read com.apple.finder AppleShowAllFiles` -eq 1 ]; then
defaults write com.apple.finder AppleShowAllFiles -bool NO;
else
defaults write com.apple.finder AppleShowAllFiles -bool YES;
fi
killall Finder;
@hkurosawa
hkurosawa / gist:2061125
Created March 17, 2012 15:24
Checks if the Android Device can handle certain Intent
public boolean canRespondToIntent(Context ctx, Intent i) {
PackageManager pm = ctx.getPackageManager();
List<ResolveInfo> l = pm.queryIntentActivities(i, PackageManager.MATCH_DEFAULT_ONLY);
if (l.size()>0) {
return true;
} else {
return false;
}
}