Skip to content

Instantly share code, notes, and snippets.

View savishy's full-sized avatar

Vish savishy

View GitHub Profile
@savishy
savishy / rename.sh
Last active February 22, 2021 16:02
Useful Little Scripts
#!/bin/bash
set -e
echo "==== rename.sh =====
This script recurses through videos in a folder, and
renames them into a format as follows:
test_[w]x[h]_[bitrate]_[duration].[extension]
e.g.
test_640x480_2973Kbps_34s.mov
@savishy
savishy / adb_commands.sh
Created March 10, 2016 08:07
A list of useful adb commands
######################################
# get and set network connection
######################################
# returns 1 if airplane mode is enabled, 0 otherwise.
adb -s $DEVICE_ID shell settings get global airplane_mode_on
# the same for wifi and mobile data.
adb -s $DEVICE_ID shell settings get global wifi_on
adb -s $DEVICE_ID shell settings get global mobile_data
2016-03-10 11:58:34:740 - info: Welcome to Appium v1.4.13 (REV c75d8adcb66a75818a542fe1891a34260c21f76a)
2016-03-10 11:58:34:742 - info: Appium REST http interface listener started on 127.0.0.1:4723
2016-03-10 11:58:34:745 - debug: Non-default server args: {"app":"D:\\vish\\ma-app-verification-android\\appium-projects\\AppiumAndroid\\CrunchAPKs\\Crunch.apk","udid":"ZX1B33GSLN","address":"127.0.0.1","log":"C:\\Users\\vish\\AppData\\Local\\Temp\\appium4723.log","loglevel":"warn:debug","localTimezone":true,"androidPackage":"com.icelero.crunch","androidWaitActivity":"app.CrunchSplashActivity","deviceName":"MotoE","platformName":"Android","platformVersion":"5.1","automationName":"Appium","chromeDriverPort":4725,"chromedriverExecutable":"C:\\Users\\vish\\AppData\\Local\\Temp\\\\chromedriver.exe","defaultCommandTimeout":600}
2016-03-10 11:58:34:745 - info: Console LogLevel: warn
2016-03-10 11:58:34:745 - info: File LogLevel: debug
2016-03-10 11:58:35:620 - info: --> GET /wd/hub/status {}
2016-03-10 11:58:35:622 - de
[testng] org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. (Original error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "D:\vish\adt-bundle\sdk\platform-tools\adb.exe shell "settings get global airplane_mode_on""
[testng] error: more than one device/emulator
[testng] ) (WARNING: The server did not provide any stacktrace information)
[testng] Command duration or timeout: 43 milliseconds
[testng] Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
[testng] System info: host: 'freeman', ip: '10.0.0.119', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_25'
[testng] Driver info: io.appium.java_client.android.AndroidDriver
[testng] Capabilities [{appPackage=com.icelero.crunch, networkConnectionEnabled=true, warnings={}, databaseEnabled=false, deviceName=MotoE, uuid=ZX1B33GSLN, platform=LINUX, appActivity=app.CrunchSplashActivity, chromedriverExecutable=C:\Users\vish\AppData\Loca
@savishy
savishy / Git Cheatsheet.md
Last active February 19, 2018 06:30
Useful git commands
@savishy
savishy / useful_knowledge.md
Last active March 30, 2017 10:25
List of useful bits of info -- how to do this, how to troubleshoot that, etc.

Systems Administration

Killing a Dangling SSH Session.

Background: I had previously SSH'd into a server and CD to directory /opt/foo when I got kicked out by network troubles. A colleague was trying to delete that directory and could not delete it.

  • SSH into the server
  • Execute who to get the active sessions.
  • Try to locate the pts/N session from the list.
  • Now execute ps -ef | grep -i sshd and from the list, locate the PID for the SSHD session that has pts/N.
@savishy
savishy / bash-tips.md
Last active December 19, 2025 04:43
Bash / Shell Tips and Tricks

execute command as another user

sudo -u <user> bash -c "<command to execute>"

list all users in system