Skip to main content

Posts

Showing posts from May, 2023

adb wm

  adb shell wm reset adb shell wm size 800 x48 0 adb shell wm density 240       adb shell wm Window manager (window) commands: help Print this help text. size [reset|WxH|WdpxHdp] [-d DISPLAY_ID] Return or override display size. width and height in pixels unless suffixed with 'dp'. density [reset|DENSITY] [-d DISPLAY_ID] Return or override display density. folded-area [reset|LEFT,TOP,RIGHT,BOTTOM] Return or override folded area. scaling [off|auto] [-d DISPLAY_ID] Set display scaling mode. dismiss-keyguard Dismiss the keyguard, prompting user for auth if necessary. disable-blur [true|1|false|0] user-rotation [-d DISPLAY_ID] [free|lock] [rotation] Print or set user rotation mode and user rotation. dump-visible-window-views Dumps the encoded view hierarchies of visible windows fixed-to-user-rotation [-d DISPLAY_ID] [enabled|disabled|default] Print or set rotating display for app requested orientation. set-ignore-orie

imagemagick

 append multiple into 1 convert in-1.jpg in-5.jpg in- N .jpg +append out-in1-plus-in5-and-in N .jpg convert -append in-*.jpg out.jpg       rotate convert image.jpg -distort SRT -45 rotate_cropped_image.png http://www.imagemagick.org/Usage/warping/#animations   http://www.imagemagick.org/script/command-line-options.php?#distort      convert -rotate 90 -compression lossless source.jp2 destination.jp2   exiftool -Orientation -n image.jpg exiftool -Orientation=1 -n image.jpg   convert input.jpg -rotate 90 out.jpg           convert < INPUT_FILE > -quality 10 % < OUTPUT_FILE > convert < INPUT_FILE > -resize 200x200 < OUTPUT_FILE > excat dimension  convert < INPUT_FILE > -resize 200x200 ! < OUTPUT_FILE >       convert < INPUT_FILE > < OUTPUT_FILE >     pngcrush -brute < INPUT_FILE > < OUTPUT_FILE > jpegoptim --size = < TARGET_SIZE > < INPUT_FILE >   convert shirish.jpg -define jpeg:extent=20k shirish-20k.jpg  

iwd ap mode

/etc/iwd/main.conf [General] EnableNetworkConfiguration=true     sudo mkdir -p /var/lib/iwd/ap/ /var/lib/iwd/ap/<ssid>.ap  [Security] Passphrase=password123 [IPv4] Address=192.168.250.1 Gateway=192.168.250.1 Netmask=255.255.255.0 DNSList=8.8.8.8    [iwd] device wlan0 set-property Mode ap [iwd]# ap wlan0 start-profile test    sudo sysctl -w net.ipv4.ip_forward=1 net.ipv4.ip_forward = 1 # sudo iptables -t nat -A POSTROUTING -s 192.168.250.0/24 -j MASQUERADE   network connection ( wlan0_sta ) itself and for the software AP/hostapd "wireless repeater(wlan0_ap)  iw dev wlan0 interface add wlan0_sta type managed addr 12:34:56:78:ab:cd   iw dev wlan0 interface add wlan0_ap type managed addr 12:34:56:78:ab:ce Wi-Fi link layer sudo pacman -S hostapd /etc/hostapd/hostapd.conf interface=wlan0_ap bridge=br0 # SSID to be used in IEEE 802.11 management frames ssid=YourWiFiName # Driver interface type (hostap/wired/none/nl80211/bsd) driver=nl80211 # Country code (ISO/IEC 3166-1) country

fstab.mt6765

 # Android fstab file. # The filesystem that contains the filesystem checker binary (typically /system) cannot # specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK #<src>                                           <mnt_point>           <type>  <mnt_flags and options>                             <fs_mgr_flags> # Core Partitions (Dynamic Partitions) system                                           /system               ext4    ro                                                  wait,avb=vbmeta_system,logical,first_stage_mount,avb_keys=/avb/q-gsi.avbpubkey:/avb/r-gsi.avbpubkey:/avb/s-gsi.avbpubkey vendor                                           /vendor               ext4    ro                                                  wait,avb,logical,first_stage_mount oppo_product                                     /oppo_product         ext4    ro                                                  wait,logical,first_stage_mount,nofail oppo_

alpine chroot in android without termux (need root)

android only allows executable files in /data/ so   adb shell  su  mkdir /data/data/home chown 777 /data/data/home cd /data/data/home mkdir ./bin curl -o ./bin/busybox https://github.com/Magisk-Modules-Repo/busybox-ndk/raw/master/busybox-arm64   EXPORT path = $PATH : $( pwd ) echo $PATH   https://raw.githubusercontent.com/dylanaraps/neofetch/master/neofetch  > neofetch    #!/system_ext/bin/bash or  #!/system/bin/env bash use proot distro https://github.com/termux/proot-distro/releases   https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/aarch64/ latest is  https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/aarch64/alpine-minirootfs-3.18.0-aarch64.tar.gz  ./busybox tar xf alpine-minirootfs-3.18.0-aarch64.tar.gz  mv alpine-arm64 alpine for proot  curl -LO "https://github.com/green-green-avk/build-proot-android/blob/master/packages/proot-android-aarch64.tar.gz" tar -xvf proot-android-aarch64.tar.gz mv ./root/bin/ * ~/bin/ mv ./root/ * ~/   nano

algorithm

sorting  linear search https://en.wikipedia.org/wiki/Linear_search   binary search needs sorted value,  time complexity = O(log(n)) The binary search tree and B-tree data structures are based on binary search.  Algorithm: Given an array of elements with values or records sorted such that , and target value , the following subroutine uses binary search to find the index of in . [7] Set to and to . If , the search terminates as unsuccessful. Set (the position of the middle element) to the floor of , which is the greatest integer less than or equal to . If , set to and go to step 2. If , set to and go to step 2. Now , the search is done; return . Pseudocode: function binary_search(A, n, T) is L := 0 R := n − 1 while L ≤ R do m := floor((L + R) / 2) if A[m] < T then L := m + 1 else if A[m] > T then R := m − 1 else : return m return unsuccessful      Pseudocode ceil version

c tutorial

   sudo apt install libc6-dev gcc make hello world file hello.c #include<stdio.h> int main(void){ printf("hello world"); }   make hello ./hello hello world   steps: preprocessing>compiling>linking  preprocessing  directives like #include pulls files from /usr/include/*.h  , #define preprocessing using gnu preprocessor(cpp)  cpp hello.c > hello.i cpp hello.c -o hello.i   or  gcc -E hello.c -o hello.i   The resultant intermediate file "hello.i" contains the expanded source code.   compiling : compiler generate assembly code. and use it to generate binary file(ELF, COFF, a.out, ...)  This object file contains the compiled code (in binary form) of the symbols defined in the input. Symbols in object files are referred to by name. Object files can refer to symbols that are not defined. This is the case when you use a declaration, and don't provide a definition for it. The compiler doesn't mind this, and will happily produce the object file as