Miscellaneous Cheat Sheet ========================= `< Blog <../blog.html>`_ A quick reference to all things miscellaneous and those things that have no home yet. Created on: 2020-02-09 Tag: `cheat_sheet `_ HTML: jump to top of page link ------------------------------ to create a jump to top of page link:: Go to top Go to top source: https://stackoverflow.com/a/11751756 CSS: Comments ------------- to add comments in CSS:: /* This is a single-line comment */ /* This is a multi-line comment */ source: https://www.w3schools.com/Css/css_comments.asp Linux ----- best place to store SSL certificate and key ``````````````````````````````````````````` store SSL certificate inside:: /etc/ssl/certs with `777` file permission. store SSL key inside:: /etc/ssl/private with `700` file permission. source: https://stackoverflow.com/a/4267602 Download all mvk files in a HTML page ````````````````````````````````````` Sometime we would need to download all the file of same type from an HTML page. We would do this with:: wget --no-directories -r -l 1 --accept='*.mkv*' $LINK source: https://serverfault.com/a/359926 Resume download with wget ````````````````````````` To resume download with `wget`_:: wget -c $LINK source: https://unix.stackexchange.com/a/165881 Download only new files with wget ````````````````````````````````` to download only new files with `wget`_:: wget -N $LINK source: https://superuser.com/a/283484 Download all new files from a HTML page with resume ``````````````````````````````````````````````````` If we combine all the above cheats we can download all new files of a type from a HTML page with resume:: wget --no-directories -r -l 1 -N -c --accept='*.ext*' $LINK Hide a particular user from login screen ```````````````````````````````````````` To hide a particular user from the login screen, first create a file with a text editor:: sudo vim /var/lib/AccountsService/users/$USER_NAME put the following:: [User] SystemAccount=true If the file already exist the change the value of `SystemAccount` to `true`, then save and exit the file. source: https://askubuntu.com/a/575390 Disable user list on login screen ````````````````````````````````` To disable user list on login screen, first create a directory, `lightdm.conf.d` inside `/etc/lightdm/`:: sudo mkdir -p /etc/lightdm/lightdm.conf.d Now create a file with a text editor named `10-ubuntu.conf`:: sudo vim /etc/lightdm/lightdm.conf.d/10-ubuntu.conf Next put the following in that file:: [SeatDefaults] user-session=ubuntu greeter-show-manual-login=true greeter-hide-users=true allow-guest=false Change the `user-session` to reflect your user session, for example, in Xubuntu the value would be xubuntu. Then save and exit the file. The effect will be visible after a reboot. source: https://askubuntu.com/a/731455 Specifically for Ubuntu the following can done as well:: sudo -i xhost +SI:localuser:gdm su gdm -l -s /bin/bash gsettings set org.gnome.login-screen disable-user-list true source: http://ubuntuhandbook.org/index.php/2018/04/hide-user-list-ubuntu-18-04-login-screen/ Bash autocomplete files location ```````````````````````````````` System-wide bash autocomplete files location:: /etc/bash_completion.d/ source: https://askubuntu.com/a/68203 Open apt manager from URL ````````````````````````` to open apt manager from URL:: apt:$PACKAGE_NAME In HTML:: click # single package click # multipule packages Needs to be Ubuntu 7.10 or later with `apturl` package installed and in a compatible browser. source: https://help.ubuntu.com/community/AptURL and https://wiki.ubuntu.com/AptUrl Do nothing when lid is closed ````````````````````````````` to take no action when lid is closed, edit the `/etc/systemd/logind.conf` file to add:: HandleLidSwitch=ignore and the edit `/etc/UPower/UPower.conf` file to add:: IgnoreLid=true sometime WiFi is still disconnects after doing this step then we may also need to add the following in the `/etc/systemd/logind.conf`:: HandleLidSwitchDocked=ignore In Ubuntu 20.04 I am noticing a new option `HandleLidSwitchExternalPower` in the `/etc/systemd/logind.conf` file. We can use it as well:: HandleLidSwitchExternalPower=ignore source: https://askubuntu.com/a/830562 see desktop environment in use `````````````````````````````` to see desktop environment in use:: echo $DESKTOP_SESSION source: https://askubuntu.com/a/125072 remove all KDE desktop element `````````````````````````````` to remove all KDE desktop element:: sudo apt-get purge '^kde' '^kubuntu' '^plasma' source: https://askubuntu.com/a/829127 ubuntu server enable root user ------------------------------ to enable root user in Ubuntu server, first set the password for root user:: sudo passwd root then unlock the user:: sudo passwd -u root we can disable root user by locking:: sudo passwd -l root source: https://askubuntu.com/a/44419 mount directory over ssh ------------------------ to mount directory over ssh, we can use `sshfs`_. First we will install it:: sudo apt-get install sshfs Then enable the fuse kernel module:: sudo modprobe fuse Now create a directory and mount remote directory to that directory:: mkdir $DIR sshfs $USER_NAME@$SERVER_IP:/$PATH $DIR To unmount simply do:: umount $DIR source: https://askubuntu.com/a/412478 apt upgrade single package -------------------------- to upgrade single package with `apt`_:: sudo apt install --only-upgrade $PACKAGE_NAME source: https://askubuntu.com/a/44124 QR Code -------- Bangladesh Railway Online Ticket ```````````````````````````````` If we scan it, we see:: TRAIN: NELSAGORE_EXPRESS (765.) // train name and number STATION: DHAKA to ABDULPUR // source station to distination station DATE: 01-JAN-1001 08:00 // date and time of train diperture from source station CLASS: S_CHAIR // seat class COACH_NO: CHA // coach number SEAT_RANGE: 1,2 // seat number E-PIN: 6NZ95 // e-pin number FULL NAME: Jane Doe // name of passenger MOBILE_NO: 01704522104 // phone number of passenger PNR_NO: 1704522104 // not sure what is it ID: 1382533015 // ID of user GATEWAY: EBL_BANK // bank with what the payment was made Dhaka University Masters Admit `````````````````````````````` If we scan it, we see:: DU-ADMT<<<1001822312< Latin-1 Supplement: ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüþÿ First message of Telegram ------------------------- channel: Channel created group: $CREATORS_DISPLAY_NAME created the group «GROUP_NAME» Source ------ .. _wget: https://linux.die.net/man/1/wget .. _sshfs: https://linux.die.net/man/1/sshfs .. _apt: https://linux.die.net/man/8/apt