Saturday, May 4, 2019

uninstall/install firefox/chrome on ubuntu


sudo apt-get purge firefox
rm -rf ~/.mozilla
sudo rm -rf /etc/firefox/
sudo rm -rf /usr/lib/firefox
sudo rm -rf /usr/lib/firefox-addons

apt-cache show firefox | grep Version
sudo apt-get install firefox=45.0.2+build1-0ubuntu1
sudo apt-mark hold firefox

wget sourceforge.net/projects/ubuntuzilla/files/mozilla/apt/pool/main/f/firefox-mozilla-build/firefox-mozilla-build_52.0-0ubuntu1_amd64.deb
sudo dpkg -i firefox-mozilla-build_52.0-0ubuntu1_amd64.deb

###################################################
old verions of chrome

https://www.slimjet.com/chrome/google-chrome-old-version.php

sudo apt-get purge google-chrome-stable
sudo apt-get autoremove google-chrome-stable

http://chromedriver.storage.googleapis.com/index.html
chromedriver    chrome
2.46            71-73
2.45            70-72
2.44            69-71
2.43            69-71
2.42            68-70
2.41            67-69
2.40            66-68
2.39            66-68
2.38            65-67
2.37            64-66
2.36            63-65
2.35            62-64
2.34            61-63
2.33            60-62
---------------------
2.28            57+
2.25            54+
2.24            53+
2.22            51+
2.19            44+
2.15            42+

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:

Wednesday, February 27, 2019

execute a script on a remote machine over ssh using expect


https://linux.die.net/man/1/expect
https://www.blogger.com/blogger.g?blogID=7297027245100107097#allposts/postNum=0

* clock
https://www.tcl.tk/man/tcl8.5/tutorial/Tcl41.html

on Macbook
brew install expect

on Ubuntu
sudo apt install expect

expect.sh

------------------------------

#!/bin/bash
nodeIp=192.168.1.176

(expect -c '
#exp_internal 1
#set timeout 15
spawn ssh root@'$nodeIp'
#expect {
#        ")? " { send "yes\r" ; exp_continue }
#        "# " { send "\r" }
#        }
expect "# "
send "rm /var/log/messages*\r"
expect "# "
send "reboot\r"
expect "# "
#send "exit\r"
    expect eof ')

------------------------------

#!/bin/bash
#foreach {host user password target} $argv {break}

#set command "ping -c 1 $target"
#send "$command\r"

#log_user 0                   ;# turn off the usual output
#expect -re "(yes/no)"
#send "yes\r"
#sleep 1

nodeIp=192.168.1.176

(
expect -c '
#exp_internal 1
#set timeout 20

set command "i2cget -y 1 0x1c 0x14"

spawn ssh root@'$nodeIp'
#expect {
#        ")? " { send "yes\r" ; exp_continue }
#        "# " { send "\r" }
#        }

expect "~# "
send_user "running $command\r\n"

send "$command\r"
expect "0x04"
send "\r"
# puts "$expect_out(0,string)\n"
if {$expect_out(0,string) == "0x04"} {
puts "output of i2cget -y 1 0x1c 0x14 is 0x04\n"
} else {
puts "False\n"
}
# puts "$expect_out(buffer)"

send "\r"
expect "~# "

send "exit\r"
expect eof '
)

Monday, February 4, 2019

taskset example


-p [process id]
./taskset -p 1760 
pid 1760's current affinity mask: f

/taskset -cp 1760
pid 1760's current affinity list: 0-3


taskset -p 0x4 1760

assign it to core0 and core3
taskset -cp 0,3 9726

Wednesday, November 7, 2018

mesh ttl

 - mesh_ttl - for data frames
 - mesh_element_ttl - for management frames