Skip to content

Instantly share code, notes, and snippets.

View scalopus's full-sized avatar

Warun Kietduriyakul scalopus

View GitHub Profile
@scalopus
scalopus / fswatch-pdf.sh
Created April 17, 2020 13:32
File System Monitoring : PDF and then automatic decrypted the file to the new folder
# Useful for the Bank transaction / Statement / or same password
# which it enable us to just download to the folder and then the
# script will automatic decrpyted the password and store the new
# file without password needs.
# Pre-requirement
# apt install qpdf fswatch
export PASSWORD=<pdfpasswordhere>
export EXPORTDIR=./decrypt
fswatch --insensitive --include "\\.pdf$" --exclude ".*" \
➜ log adb logcat
--------- beginning of main
03-01 14:40:17.692 1760 1774 E memtrack: Couldn't load memtrack module
03-01 14:40:17.692 1760 1774 W android.os.Debug: failed to get memory consumption info: -1
03-01 14:40:17.704 1760 1774 E memtrack: Couldn't load memtrack module
03-01 14:40:17.704 1760 1774 W android.os.Debug: failed to get memory consumption info: -1
03-01 14:40:17.714 1760 1774 E memtrack: Couldn't load memtrack module
03-01 14:40:17.715 1760 1774 W android.os.Debug: failed to get memory consumption info: -1
03-01 14:40:19.379 1760 7015 D WificondControl: Scan result ready event
03-01 14:40:26.678 7614 7614 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
[info] [Appium] Welcome to Appium v1.7.2
[info] [Appium] Appium REST http interface listener started on 0.0.0.0:4723[info] [HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"app":"/Users/warun/dev/scb-appium-tests/apps/app-automation-debug.apk","automationName":"uiautomator2","platformName":"Android","deviceName":"Android","platformVersion":"8.0"}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"/Users/warun/dev/scb-appium-tests/apps/app-automation-debug.apk","automationName":"uiautomator2","platformName":"Android","deviceName":"Android","platformVersion":"8.0"},null,null]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1519915023626 (21:37:03 GMT+0700 (+07))
[info] [Appium] Creating new AndroidUiautomator2Driver (v0.11.0) session
[info] [Appium] Capabilities:
[info] [Appium] app: /Users/warun/dev/scb-appium-tests/apps/app-automation-debug.apk
[info] [Appium] automationName: uiautomator2
[info] [Appium] platformName: Android
[info] [Appium] deviceName: Andro
@scalopus
scalopus / tcp-dump.sh
Last active February 8, 2022 20:53
TCPDump: Monitoring `locahost` for Graylog, statsd, fluentd (MacOS)
sudo tcpdump -A -s0 -ilo0 port 24224 or port 12201 or port 8125
@scalopus
scalopus / My-IP-to-Slack.sh
Created January 27, 2016 02:42
Current IP Address from `ifconfig` to Slack Channel Integration
#!/bin/bash
# Tested on Ubuntu 14.04 LTS
ifconfig |grep '192.168.9'|cut -d: -f2 |awk '{print "{\"text\":\""$1"\"}"}' |curl -X POST -H 'Content-type: application/json' --data @- https://hooks.slack.com/services/<SLACKTOKEN>
-----BEGIN CERTIFICATE-----
MIICTTCCAbYCCQDlDv0nlSxWRDANBgkqhkiG9w0BAQUFADBqMQswCQYDVQQGEwJT
RzETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0
cyBQdHkgTHRkMSMwIQYDVQQDDBphcGkubG9jYWwucHJvcGVydHlndXJ1LmNvbTAg
Fw0xMzEwMDkwNzQyNDFaGA8yMTEzMDkxNTA3NDI0MVowajELMAkGA1UEBhMCU0cx
EzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMg
UHR5IEx0ZDEjMCEGA1UEAwwaYXBpLmxvY2FsLnByb3BlcnR5Z3VydS5jb20wgZ8w
DQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMA4Mq3gDfYNw7kbbMefaIUbc9JfMOCt
YP71R6jPIKBdT3KYke3OgnNePDBvVvReeODC3YKRSXGJx0V258HBaxVFOyh6Qa/Q
af6pkjh7JSgBr+cqzya82IC56mD6FzC+U4V3FcNgBxDfijE5tG1eKcq6Zxtur7y8
@scalopus
scalopus / compare.sql
Created September 3, 2015 08:08
Compare Schema on Two Table
SELECT table_name,column_name,ordinal_position,data_type,column_type,column_default,
is_nullable,
CHARACTER_MAXIMUM_LENGTH,
CHARACTER_OCTET_LENGTH,
NUMERIC_PRECISION,
NUMERIC_SCALE,
DATETIME_PRECISION,
CHARACTER_SET_NAME,
COLLATION_NAME,
EXTRA FROM
@scalopus
scalopus / cap
Created July 16, 2015 08:02
Record Screen as Git Image
#!/bin/bash
# AUTHOR: (c) Rob W 2012, modified by MHC (http://askubuntu.com/users/81372/mhc)
# NAME: GIFRecord 0.1
# DESCRIPTION: A script to record GIF screencasts.
# LICENSE: GNU GPL v3 (http://www.gnu.org/licenses/gpl.html)
# DEPENDENCIES: byzanz,gdialog,notify-send (install via sudo add-apt-repository ppa:fossfreedom/byzanz; sudo apt-get update && sudo apt-get install byzanz gdialog notify-osd)
# Time and date
TIME=$(date +"%Y-%m-%d_%H%M%S")
@scalopus
scalopus / common-config.sh
Created February 27, 2015 11:19
PHP-Build After Script to make common config on one major version example
#!/bin/bash
PHP_MINOR=`echo $PREFIX | sed 's:.*/::' | sed 's:[0-9]\.[0-9]\.::'`
COMMON_DIR_PREFIX=`echo $PREFIX | sed 's:\.[0-9]\+\$::'`
COMMON_DIR="$COMMON_DIR_PREFIX.0"
if [ "$PHP_MINOR" == "0" ]; then
echo "Major version.... skipped";
sed -i.bak 's:\(memory_limit \= \)[0-9]\+M:\12048M:' $PREFIX/etc/php.ini
sed -i.bak 's:\;\(date\.timezone \=\):\1 Asia\/Bangkok:' $PREFIX/etc/php.ini
@scalopus
scalopus / common-config.sh
Created February 27, 2015 09:00
php-build-common-config
#!/bin/bash
# Copy this file to ./php-build/share/php-build/after-install.d
# This file is to keep all minors version use the same configuration file.
# This will required you to install the base version.
# Ex.
# 5.4.10 use 5.4.0 as configuration
# you have to install 5.4.0 at first.