Skip to content

Instantly share code, notes, and snippets.

[Temperatures_CPU]
> 0x6A 0x37
> 0x6B 0x3D
> 0x6C 0x43
> 0x6D 0x49
> 0x6E 0x4F
> 0x6F 0x4F
> 0x70 0x64
[FanSpeeds_CPU]
@salehjg
salehjg / Android-Studio-use-libopencv.so.md
Last active March 25, 2023 15:24
Android Studio+NDK+OpenCV shared library (tested on Android Studio 2022.1, SDK 33, NDK 21, and Device API 26)
  1. Follow this gist to build OpenCV shared library for Android.
  2. Create a new project, Java, MinSDK API26.
  3. In Project Side Bar, right click on App and select New -> Folder -> JNI Folder.
  4. Check the Change Folder Location check box and rename the last part of the path from src/main/jni/ to src/main/jniLibs/ .
  5. Go to your OpenCV/01_ndk_outputs/sdk/native/libs source directory and select all the folders and copy them into jniLibs of your Android Studio project.
  6. It is assumed that your phone is a arm64-v8a.
  7. Open your app's build.gradle and add this to defaultConfig entry:
externalNativeBuild{
            cmake{
@salehjg
salehjg / OpenCV-NDK-Build.md
Last active March 10, 2023 19:58
How to build OpenCV for NDK from source.

Pre Requisities

  1. Use a Linux OS. It is assumed that Arch Linux is used.
  2. Install the latest version of Android Studio.
  3. Use SDK Manger of Android Studio to install your SDK 25, NDK 21.4.7075529, and BuildTools 25.0.3 of your choice.
  4. Install the packages that we are going to need on your linux: sudo pacman -S cmake git aria2 ant unzip ant
  5. Make sure you have a suitable python2, python3, and jdk

OpenCV Versions

If you need the cv1 interface of OpenCV, you should use version < 4. Versions>=4 only have the cv2 interface. We are going to use OpenCV 3.4.16 .

@salehjg
salehjg / vpn-hotspot.sh
Created January 4, 2023 21:03 — forked from ShapeShifter499/vpn-hotspot.sh
vpn hotspot script
#!/storage/xbin/bash
# This script should help forward VPN over any tethered connection on a Android device. Turn on tethering, then enable VPN, then run this script.
# Inital variable setup
tethering=0
# Setup iptables before forwarding VPN
iptables -A POSTROUTING -o tun0 -j MASQUERADE -t nat
@salehjg
salehjg / non-adb-root.sh
Last active January 3, 2023 22:53
An ADB script to share the VPN on an android device with its hotspot USB/WIFI
echo "RUN AS ROOT ON THE ANDROID DEVICE (TERMUX: SU: NEXT LINE)"
ip rule show | grep 'iif rndis0 lookup tun0' || ip rule add from all iif rndis0 lookup tun0 pref 17999; iptables -n -v -L natctrl_FORWARD | grep 'ACCEPT all -- rndis0 tun0' || iptables -I natctrl_FORWARD 4 -i rndis0 -o tun0 -j ACCEPT; iptables -n -v -L natctrl_FORWARD | grep 'ACCEPT all -- tun0 rndis0' || iptables -I natctrl_FORWARD 4 -i tun0 -o rndis0 -m state --state RELATED,ESTABLISHED -j ACCEPT
@salehjg
salehjg / Springer.CSSP.bst
Created August 28, 2022 13:25
BibTeX Style File for Springer CSSP (Journal) - Unofficial - Use it at your own risk
%%
%% This is file `spbasic.bst',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% merlin.mbs (with options: `ay,nat,seq-lab,vonx,nm-rvx,ed-rev,jnrlst,dt-beg,yr-par,yrp-x,yrpp-xsp,note-yr,jxper,jttl-rm,thtit-a,pgsep-c,num-xser,ser-vol,jnm-x,btit-rm,bt-rm,pre-pub,doi,edparxc,blk-tit,in-col,fin-bare,pp,ed,abr,mth-bare,ord,jabr,xand,eprint,url,url-blk,em-x,nfss,')
%% ----------------------------------------
%%
%%********************************************************************************%%

Setup Canon LBP-6030B on ArchLinux

  1. Install $ sudo pacman -S ghostscript
  2. Install $ yay -S cups
  3. Enable its service $ sudo systemctl enable cups.service
  4. Restart the service $ sudo systemctl restart cups.service
  5. Check its status $ sudo systemctl status cups.service
  6. Install $ yay -S cnrdrvcups-sfp
  7. BE AWARE THAT LBP-6030B is a UFRII-LT printer with sfp. Only use cnrdrvcups-lb package if your printer is LBP6030 (white version, USA)!!
  8. Open http://localhost:631/ in Chrome.
  9. Go to Administration and then click on Add Printer
@salehjg
salehjg / 70-huawei-e3.conf
Created July 27, 2021 00:53 — forked from smarek/70-huawei-e3.conf
Raspberry / Banana Huawei E3372 network interface name
# /etc/udev/rules.d/70-huawei-e3.conf
# Necessary for network interface name
SUBSYSTEM=="net", ACTION=="add", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="14dc", NAME="usb0"
# Might be duplicate to usb_modeswitch config, however it's good to have it there
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1f01", RUN+="/usr/sbin/usb_modeswitch -c /etc/usb_modeswitch.d/huawei_e3.conf"
void myfunc(
int *inputTn1,
int *inputTn2,
int *outputTn,
int len) {
#pragma HLS INLINE
for(int idx=0; idx<len; idx++){
#pragma HLS PIPELINE II=1