Skip to content

Instantly share code, notes, and snippets.

@tsohr
tsohr / gist:5711945
Created June 5, 2013 06:15
Android activity manager "am" command help
adb shell am
usage: am [subcommand] [options]
usage: am start [-D] [-W] [-P <FILE>] [--start-profiler <FILE>]
[--R COUNT] [-S] [--opengl-trace] <INTENT>
am startservice <INTENT>
am force-stop <PACKAGE>
am kill <PACKAGE>
am kill-all
am broadcast <INTENT>
am instrument [-r] [-e <NAME> <VALUE>] [-p <FILE>] [-w]
@tsohr
tsohr / allow_sshd.cmd
Created March 16, 2016 03:17
Add Window firewall exception to allow cygwin sshd
netsh advfirewall firewall add rule name=httpd dir=in action=allow program='C:\cygwin64\usr\sbin\sshd.exe' enable=yes description=cygwin_sshd
netsh advfirewall firewall add rule name=httpd dir=out action=allow program='C:\cygwin64\usr\sbin\sshd.exe' enable=yes description=cygwin_sshd
@tsohr
tsohr / setup.sh
Created April 23, 2021 05:55
Proxmox installation with Realtek 8125 device.
# root@pve2:/etc/apt/sources.list.d# lspci | grep -i real
# 08:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. Device 8125 (rev 05)
# boot up with "DEBUG" mode
# ctrl-d for the first prompt
# connect another thethering network ...
ip addr show
ip link set enp12s0f3u3 up
@tsohr
tsohr / cygwin_settings.sh
Last active May 31, 2022 09:48
My cygwin initial preference
# place setup-x86_64.exe under the cygwin root directory
#apt-cyg
/setup-x86_64.exe -q -P wget,tar,qawk,bzip2,subversion,vim
wget 'http://rawgit.com/transcode-open/apt-cyg/master/apt-cyg'
chmod a+x apt-cyg
mv apt-cyg /bin/
#/etc/profile
/bin/date -D "%s" -d $(( $(/bin/date +%s ) - 86400 )) +%Y-%m-%d
#https://forum.synology.com/enu/viewtopic.php?t=50992
@tsohr
tsohr / getRandomExternalImageContent.java
Last active September 17, 2021 04:41
Get an image resource from external content resolver randomly in Android.
protected static Uri getRandomExternalImageContent(Context c) {
ContentResolver resolver = c.getContentResolver();
if (resolver == null)
return null;
String [] proj = { MediaStore.Images.Media.DATA };
Cursor cursor = resolver.query(Images.Media.EXTERNAL_CONTENT_URI, proj, null, null, null);
int count = cursor.getCount();
int position = (int) (Math.random() * count);
@tsohr
tsohr / install_forticlientsslvpn_linux
Last active August 30, 2021 04:52 — forked from zealfire/install_forticlientsslvpn_linux
Install forticlient in linux. Replace HOST, PORT, USER and PASS.
sudo apt-get install expect
wget https://hadler.me/files/forticlient-sslvpn_4.4.2333-1_amd64.deb
sudo dpkg -i forticlient-sslvpn_4.4.2333-1_amd64.deb
/opt/forticlient-sslvpn/64bit/helper/setup
cat > sslvpn << EOF
#!/usr/bin/expect -f
@tsohr
tsohr / install_forticlient_linux.sh
Created August 27, 2021 06:10 — forked from PieterScheffers/install_forticlient_linux.sh
Install Forticlient on Linux
# install ubuntu in virtual machine
# https://ubuntuforums.org/showthread.php?t=1481300
# Get arch type of ubuntu
# i686 = 32 bit
# x86_64 = 64 bit
uname -m
# download forticlient
https://hadler.me/linux/forticlient-sslvpn-deb-packages
@tsohr
tsohr / after.out
Created April 27, 2021 05:06
Turn off sensord false alarm.
nct6779-isa-0290
Adapter: ISA adapter
Vcore: 512.00 mV (min = +0.00 V, max = +1.74 V)
AVCC: 3.31 V (min = +2.98 V, max = +3.63 V)
+3.3V: 3.31 V (min = +2.98 V, max = +3.63 V)
3VSB: 3.44 V (min = +2.98 V, max = +3.63 V)
Vbat: 3.26 V (min = +2.70 V, max = +3.63 V)
in9: 0.00 V (min = +0.00 V, max = +0.00 V)
fan1: 940 RPM (min = 0 RPM)
fan2: 1433 RPM (min = 0 RPM)
@tsohr
tsohr / asus router mapping.js
Created March 8, 2021 09:02
Extract DHCP configuration from the Synology DHCP client table UI
function create_clientlist_listview() {
all_list = [];
wired_list = [];
wl1_list = [];
wl2_list = [];
wl3_list = [];
if (document.getElementById("clientlist_viewlist_block") != null) {
removeElement(document.getElementById("clientlist_viewlist_block"));
}
var divObj = document.createElement("div");