Skip to content

Instantly share code, notes, and snippets.

View sobujbd's full-sized avatar

Sobuj sobujbd

  • Bangladesh
View GitHub Profile
@sobujbd
sobujbd / android-select-device.sh
Created October 15, 2018 17:33
Select Android Devices Serial for ADB
#!/bin/bash
# selects an android device
PROGNAME=$(basename $0)
UNAME=$(uname)
DEVICE_OPT=
for opt in "$@"
do
case "$opt" in
@sobujbd
sobujbd / adb_screencap.sh
Created October 15, 2018 17:31
ADB Screen Capture
#!/bin/bash
# read -e -p "Enter File URL: " fileUrl
# if [ -z "${fileUrl}" ];then
# echo "Missing File URL!"
# exit
# fi
APP_NAME=$1
@sobujbd
sobujbd / .inputrc
Created October 7, 2018 04:57
Bash history search with up-arrow, down-arrow
## arrow up
"\e[A":history-search-backward
## arrow down
"\e[B":history-search-forward
@sobujbd
sobujbd / filesize.sh
Created October 7, 2018 02:49
File Size | Shell Script
#!/bin/bash
# read -e -p "Enter File URL: " fileUrl
# if [ -z "${fileUrl}" ];then
# echo "Missing File URL!"
# exit
# fi
bytesToHuman() {
@sobujbd
sobujbd / runavd.sh
Last active October 6, 2018 14:37
Run Android Emulator (AVD) from Bash Script
#!/bin/bash
function selectAVD()
{
echo "Available AVDs:"
$emuDir/emulator -list-avds
echo "Which AVD would you like to use?"
read myAVD
ARRAY=($($emuDir/emulator -list-avds))
isIn=false
@sobujbd
sobujbd / git-archive.sh
Created August 20, 2018 11:59
git-archive.sh
#!/bin/bash
git init # on the root of the project folder
git add .
git commit -m "git archive"
FOLDERNAME="backup"
CURRENTFOLDERNAME="${PWD##*/}"
FILENAME="archive_$(date +%d)_$(date +%m)_$(date +%Y)_$(date +%I)$(date +%M)$(date +%S)"
mkdir -p "$FOLDERNAME"
git archive HEAD --format=zip --prefix=$CURRENTFOLDERNAME/ > backup/$CURRENTFOLDERNAME-$FILENAME.zip
echo Saved as $CURRENTFOLDERNAME-$FILENAME.zip
@sobujbd
sobujbd / curl get file size.md
Created August 15, 2018 18:31
curl get file size

curl -sI | grep -i Content-Length | awk '{print $2/1024}'

@sobujbd
sobujbd / unzip.php
Created November 14, 2017 05:34 — forked from trajche/unzip.php
Unzip a file on one.com with PHP
<?php
$unzip = new ZipArchive;
$out = $unzip->open('file-name.zip');
if ($out === TRUE) {
$unzip->extractTo(getcwd());
$unzip->close();
echo 'File unzipped';
} else {
echo 'Something went wrong?';
@sobujbd
sobujbd / -
Created October 19, 2017 13:45
Hello World
@sobujbd
sobujbd / install.php
Created September 30, 2017 06:50 — forked from tschoffelen/install.php
A simple PHP script that automatically downloads and unzips the latest version of Wordpress in the current directory (./), so that I don't have to download it and upload it to my server through FTP manually.
<?php
echo '<pre>';
echo '<span style="color:blue">DOWNLOADING...</span>'.PHP_EOL;
// Download file
file_put_contents('wp.zip', file_get_contents('http://wordpress.org/latest.zip'));
$zip = new ZipArchive();
$res = $zip->open('wp.zip');
if ($res === TRUE) {