Notes

ssh

Generate RSA key pair

ssh-keygen -t rsa

Add ssh key to remote machine for passwordless ssh

ssh-copy-id -i ~/.ssh/id_dsa.pub user@example.com

Tunnel through ssh to remote server

ssh -NfL 3333:localhost:3306 user@example.com

git

Work around error “CRLfile: none while accessing”

git config --global --add http.sslVerify false

Make an exiting branch track a remote branch

git br --set-upstream  origin/branch_name

Push new local branch to remote repository

git push   # e.g. git push origin new_branch

Push a local branch to remote repository and make it tracking

git push -u

Debian package

Install dselect tool

apt-get install dselect

Save a list of installed packages

dpkg --get-selections > packages_list

Restore saved packages list

dpkg --set-selections < packages_list
apt-get -u dselect-upgrade
apt-get autoremove

mysql

Backup

mysqldump -u USER --password=PWD --host=DB_HOST DB_NAME > FILE_NAME

Restore

mysql -u USER -p PWD -h DB_HOST DB_NAME < FILE_NAME

Create database

create database database_name;

Create user

CREATE USER 'user'@'localhost' IDENTIFIED BY '********';

Grant privileges to user on database

GRANT ALL PRIVILEGES on database_name.* TO 'user'@'localhost' IDENTIFIED BY '********' WITH GRANT OPTION;

Flush

flush privileges;

Storage devices

Find UUID of drive

blkid /dev/mapper/sil_aiaebhccdjce

Mount by UUID

mount -U cc9e625e-cbf2-4620-bb93-ee59a86f4b33 /mnt/raid1/

Get fstab info from current mounts

cat /proc/mounts

Android

Remount read/write

mount -o rw,remount /dev/block/mmcblk0p4 /system

qmake

Configure external library

unix {
    CONFIG += link_pkgconfig
    PKGCONFIG += python2
}

All users X access

xhost +local: > /dev/null

Mouse buttons to page up/down

xbindkeys --defaults > ~/.xbindkeysrc
"xte 'key Page_Up'"
  b:6 + Release
 
"xte 'key Page_Down'"
  b:7 + Release

RAID

Update mdadm.conf

/usr/share/mdadm/mkconf > /etc/mdadm/mdadm.conf

Scan

mdadm --detail --scan

Info

cat /proc/mdstat

Rename

mdadm --assemble /dev/md2 --name=md2 --update=name /dev/sd[ab]2

Firefox prefs

Open related tabs predictably

browser.tabs.insertRelatedAfterCurrent = false

Don’t add www or .com to typed urls

browser.fixup.alternate.enabled = false

Leave the tab-close button at fixed place

browser.tabs.closeButtons = 3

Let’s Encrypt

Configuring lets encrypt certificate manually for apache web server: letsencrypt-nosudo.

Creating the intermediate cert chain:

  1. Download Let’s Encrypt Authority X3
  2. Download IdenTrust DST Root CA X3
  3. Add
    -----BEGIN CERTIFICATE-----
    -----END CERTIFICATE-----

    to DST Root CA X3

  4. cat both certs into letsencrypt-chain.pem

MPD

Pulse Audio

Where pulse audio is run under logged in user but mpd as a different user:

In /etc/pulse/default.pa

< #load-module module-native-protocol-tcp
---
> load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1

In /etc/mpd.conf

audio_output {
        type            "pulse"
        name            "My Pulse Output"
        server          "localhost"             # optional
}

Leave a Reply

Your email address will not be published. Required fields are marked *