Posts

getLongest

func main () { fmt . Print ( getLongest ( "111131111" )) } func getLongest ( input string ) string { arr := make ([][] bool , len ( input )) for i := range arr { arr [ i ] = make ([] bool , len ( input )) } r := input [ 0 : 1 ] for i := 0 ; i < len ( input ); i ++ { arr [ i ][ i ] = true if i != len ( input )- 1 && input [ i ] == input [ i + 1 ] { r = input [ i : i + 1 ] arr [ i ][ i + 1 ] = true } } for lenght := 3 ; lenght <= len ( input ); lenght ++ { for i := 0 ; i < len ( input ); i ++ { j := i + lenght - 1 if j < len ( input ) && isPar ( i , j , input , arr ) { arr [ i ][ j ] = true r = input [ i : j + 1 ] } } } return r } func isPar ( i , j int , s string , arr [][] bool ) bool { if i == j { arr [ i ][ j ] = true return true } else { if i + 1 == j && s [ i ] == s [ j ]...

dpkg remove program

ref :  https://www.howtogeek.com/229699/how-to-uninstall-software-using-the-command-line-in-linux/ dpkg --list and remove You can use the remove and force flags: $ sudo dpkg -r --force-all pkg_name Alternatively, if you installed it through Ubuntu Package Manager, you can remove it with apt: $ sudo apt remove --purge pgk_name Installing .deb debian package file in Ubuntu Double click the .deb file , it will be automatically opened with the GDebi Package manager and you can install it From command line , use this command to install a package . sudo dpkg -i PACKAGEFILE.deb Uninstalling a package in Ubuntu From command line, use this command sudo dpkg -r PACKAGENAME

apt remove program

apt-get remove packagename will remove the binaries, but not the configuration or data files of the package  packagename . It will also leave dependencies installed with it on installation time untouched. apt-get purge packagename  or  apt-get remove --purge packagename will remove about  everything  regarding the package  packagename , but not the dependencies installed with it on installation. Both commands are equivalent. Particularly useful when you want to 'start all over' with an application because you messed up the configuration. However, it does not remove configuration or data files residing in users home directories, usually in hidden folders there. There is no easy way to get those removed as well. apt-get autoremove removes orphaned packages, i.e. installed packages that used to be installed as an dependency, but aren't any longer. Use this after removing a package which had installed dependencies you're no longer interested in....

Apt and apt-get tutorial

Let’s see which apt command replaces which apt-get and apt-cache command options. apt command the command it replaces function of the command apt install apt-get install Installs a package apt remove apt-get remove Removes a package apt purge apt-get purge Removes package with configuration apt update apt-get update Refreshes repository index apt upgrade apt-get upgrade Upgrades all upgradable packages apt autoremove apt-get autoremove Removes unwanted packages apt full-upgrade apt-get dist-upgrade Upgrades packages with auto-handling of dependencies apt search apt-cache search Searches for the program apt show apt-cache show Shows package details apt list Lists packages with criteria (installed, upgradable etc) apt edit-sources Edits sources list

How to list all installed apps in Linux debian

That depends on your distribution. 1. Aptitude-based distributions (Ubuntu, Debian, etc): dpkg -l 2. apt list --installed 3. snap list 2. RPM-based distributions (Fedora, RHEL, etc): rpm -qa 3. pkg*-based distributions (OpenBSD, FreeBSD, etc): pkg_info 4. Portage-based distributions (Gentoo, etc): equery list or eix -I 5. pacman-based distributions (Arch Linux, etc): pacman -Q 6. Cygwin: cygcheck --check-setup --dump-only * 7. Slackware: slapt-get --installed

install golang

Open your terminal and navigate to your downloads folder cd /root/Downloads Extract the files tar -C /usr/local/ -xzf go1.13.6.linux-amd64.tar.gz Add variables for GO by modifying  “~/.bashrc” vim ~/.bashrc Add the following paths to the end of the file export GOPATH=/root/go-workspace export GOROOT=/usr/local/go PATH=$PATH:$GOROOT/bin/:$GOPATH/bin Now we need to refresh the bashrc to get the updated variables source ~/.bashrc

Snap tutorial

ref:  https://snapcraft.io/docs/getting-started 0. install snapd $ apt update $ apt install snapd $ systemctl enable --now snapd apparmor $ systemctl start snapd 1. snap version 2. snap list       or               $ snap list --all app_name bonh@kali:~$ snap version snap    2.44.1-2 snapd   2.44.1-2 series  16 kali    2020.2 kernel  5.4.0-kali2-amd64 bonh@kali:~$ snap list Name               Version                     Rev   Tracking       Publisher   Notes core               16-2.44.1                   8935  latest/stable  canonical✓  core core18             20200311      ...