Skip to content

Instantly share code, notes, and snippets.

@for2ando
for2ando / make-stock-recovery
Created July 1, 2017 13:54
Make stock recovery.img from boot (kernel) image on a Android device and several saved configuration file. Requires adb connection to the Android device.
#!/usr/bin/bash
progname=`basename "$0"`
usage="$progname check ConfDir
check if the current installed recovery is the stock recovery
which designated by the configuration.
$progname make ConfDir [Out]
make a stock recovery image file from the configuration
and the boot image on the phone.
ConfDir a directory includes install-recovery.sh and recovery-from-boot.p
Out file name for a recovery image made. [default=recovery.img]"
@for2ando
for2ando / getfilebk
Created July 1, 2017 14:21
Back up several configuration files from Android device via adb.
#!/bin/sh
adb shell ls /system || { echo $0:Please connect w/ adb.>&2; exit 2; }
for i in build.prop recovery-from-boot.p etc/recovery-resource.dat bin/install-recovery.sh; do
test -f $i && { echo $0: $i: exists. Please delete it and retry.>&2; exit 3; }
done
mkdir -p bin etc
adb pull /system/build.prop .
adb pull /system/recovery-from-boot.p .
adb pull /system/etc/recovery-resource.dat etc
adb pull /system/etc/install-recovery.cfg etc
@for2ando
for2ando / backup-and-list
Created July 11, 2017 11:18
A shell script for backup and then make lists of backup files and write the list to files in source directories.
#!/bin/bash
LIST_FILE_NAME='BKLIST.txt'
LIST_CMD='ls -l -R'
pname=$(basename "$0")
usage="$pname [-ls DirGlobToMakeListFile] SourceDir DestDir
OPTIONS
SourceDir
A source directory of copying (not a miroring)
DestDir
A destination directory of copying
@for2ando
for2ando / get-android-app-name
Last active June 16, 2018 11:54
Get Android Application's pet name and print for given application IDs.
#!/bin/bash
pname=$(basename "$0")
usage="$pname [-h|--help|-inpqw] {AppId [...]|-}
FEATURES
print an application name of an Android application that designated with
AppId.
OPTIONS
-h --help
print this help message.
-i
@for2ando
for2ando / xcygstart
Last active March 19, 2019 10:14
Slightly extended cygstart command clone for cygwin (and expected for msys2).
#!/bin/bash
usage="$0 [Options] [NumberOfSkippingPathConvert] Command [Args]
Description:
call spacified command with spacified args which is replaced path-delimiter
character / to \.
Options:
-c with cmd.exe (Command is executed with 'cmd.exe /k')
-x (not implemented yet)
-s synchronize execution (wait a termination of Command)
-n dry run mode
@for2ando
for2ando / chromeKeyBinderScript
Created March 19, 2019 10:26
my keyboard assignment script for a lost ancient Chrome Extension named as 'KeyBinder'.
set c-q
ubind bsic <c-q>
bind bsich <c-q> [mode.change n]
bind bsich <f10> [mode.change p]
set c-w
#ubind b <c-w>
#ubind sichno <c-w>
#bind bsichno <c-w> [nop]
#bind bs <c-w> [selection.kill]
// ========================== KeySnail Init File =========================== //
// この領域は, GUI により設定ファイルを生成した際にも引き継がれます
// 特殊キー, キーバインド定義, フック, ブラックリスト以外のコードは, この中に書くようにして下さい
// ========================================================================= //
//{{%PRESERVE%
// ここにコードを入力して下さい
//}}%PRESERVE%
// ========================================================================= //
@for2ando
for2ando / README_md_template
Created June 11, 2019 10:15
My template for README.md on github.
Name
====
Overview
## Description
## Demo
## VS.
@for2ando
for2ando / sudo
Created July 25, 2020 11:27
a simple sudo command for Windows with Cygwin.
#!/bin/sh
pname=$(basename "$0")
usage="$pname [-c|--console] Command [Argument ...]
$pname {-h|--help)
FEATURES
execute Command with Argument(s) on Windows's 'elevated' state.
OPTIONS
-c, --console
open another window and print the output of the elevated Command there.
@for2ando
for2ando / git_tree_alias.txt
Created October 12, 2020 13:39
Put it on ~/.gitconfig, so that you can use the pretty 'git tree' command ! (from https://qiita.com/hirotsugu_kawa/items/41afaafe477b877b5b73 )
[alias]
tree = log --graph --pretty=format:'%x09%C(auto) %h %Cgreen %ar %Creset%x09by"%C(cyan ul)%an%Creset" %x09%C(auto)%s %d'