Friday, March 29, 2019

DMA / Invalidate / Flush

Flush: write back the contents of cache to main memory
Invalidate: mark cache lines as invalid so that future reads go to main memory.
Dirty: mark DMA memory region "dirty", so that CPU will invalidate the region

DDR memory -> HW buffer:
1. Flush DDR memory (no flush on HW buffer needed because it's not cacheable)
2. Invalidate DDR memory (so no cache line used during DMA)

https://stackoverflow.com/questions/7132284/dma-cache-coherence-management

Thursday, March 7, 2019

To disable suspend from closing lid


https://help.ubuntu.com/stable/ubuntu-help/power-closelid.html.en

  1. Open the Activities overview and start typing Tweaks.
  2. Click Tweaks (GNOME Tweaks) to open the application.
  3. Click the Power tab.
  4. Switch Suspend when laptop lid is closed to OFF.
  5. Close the Tweaks window.

Friday, March 1, 2019

store / remove ssh key (git passphrase)



********************
*
********************
$ eval $(ssh-agent)
## The output without the eval will look like this:
$ ssh-agent
ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-hvcwJQnSOHOi/agent.125894; export SSH_AUTH_SOCK;
SSH_AGENT_PID=125895; export SSH_AGENT_PID;
echo Agent pid 125895;

After the ssh-agent is started (with the eval). You can add SSH keys with ssh-add

$ ssh-add ~/.ssh/google
$ ssh-add ~/.ssh/id_rsa

With current versions of SSH you can also add the option AddKeysToAgent to the ~/.ssh/config file:

## ~/.ssh/config
AddKeysToAgent yes


********************
* Remove known host
********************
ssh-keygen -R 192.168.123.254

********************
*
********************
~/.bashrc
SSH_ENV=$HOME/.ssh/environment
# start the ssh-agent
function start_agent {
    echo "Initializing new SSH agent..."
    # spawn ssh-agent
    /usr/bin/ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}
    echo succeeded
    chmod 600 ${SSH_ENV}
    . ${SSH_ENV} > /dev/null
    /usr/bin/ssh-add
}

if [ -f "${SSH_ENV}" ]; then
     . ${SSH_ENV} > /dev/null
     ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
        start_agent;
    }
else
    start_agent;
fi


********************
* MacBook
********************

As of macOS Sierra 10.12.2 Apple added an ssh_config option called UseKeychain which allows a 'proper' resolution to the problem. Add the following to your ~/.ssh/config file: