Monday, May 6, 2019

Multiple git accounts

Using multiple ssh keys for multiple gits:
https://gist.github.com/jexchan/2351996
Add the ssh keys on github

Some possible "git config --list" options are "--local" and "--global"
If you don't specify --global, it takes the local config by default.

To display the actual  “git config” do:
git config --list
git config user.name
git config user.email

Before you commit, you need to be sure you are using the correct one.
You can set it by doing:
git config user.name "abc"
git config user.email "abc@abc.com"

The local config will be saved in .git/config
The global config is saved in ~/.gitconfig

"url" must be a git@something  in .git/config, should not be https. If it is https, use:
“git remote set-url origin git@github.com:me/gg-linux.git”
It will change your .git/config

_______ git clone
Even if the keys are on github, you may want to use a specific name/email
You can use
git clone XX -c user.name=toto -c user.email=toto@toto.com (this will set .git/config)
or
git config --global user.name "xxx"
git config --global user.mail "xxx"
git clone git@github.com:youruser/myj-gh     (need ssh keys)

Tuesday, April 16, 2019

Google services empty the battery

Android is up to date.
Google Services is making continuous network access and empty the battery. It stops when network is disabled.

solution: register for the Google Services beta program. That's the only way to update/change Google Services
.

Thursday, February 14, 2019

Mac survival kit


  • ask different
  • fonctionalities
    • fn + F12.  go to dashboard (calendar, calculator)
  • about .bash_profile
  • MacOS (formerly OS X) is based on BSD Unix
  • list of installs made:
    • less /Library/Receipts/InstallHistory.plist
  • machine info
    • sysctl -n machdep.cpu.brand_string
    • system_profiler | grep Processor
    • system_profiler
  • updatedb
    • (base) lee@a8:~$ sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
    • (base) lee@a8:~$ sudo /usr/libexec/locate.updatedb
    • (base) lee@a8:~$ locate logs
  • install kdiff3
  • if you need to untar things like mvn, you can do so in /usr/local using sudo. Other folders are protected even using sudo 
  • colors
    • console and vi: 
      • go to terminal (console) / preferences / Profiles / Basic / ANSI Colors
      • change them
  • brew
    • brew list
    • brew doctor
    • brew services list
    • brew services info docker-machine 
    • brew services start tomcat
  • zsh
    • ps -ef,   htop prefered
    • sometimes buggy, switch to bash 
      • ex: find . |grep ".py"|xargs grep fill  (not working on my zsh)
    • this works on zsh but not on sh for big files
      • sort -u toto.txt > out.txt
  • network (use bash)
    • tcpdump -n -A -p -i lo0 host 127.0.0.1 > tmp.txt


.

Tuesday, February 5, 2019

Wednesday, January 23, 2019

Data types comparison

\ JSON Python STL
object JSON object
{
  "fist_name" : "John",
  "last_name" : "Doe"
}
(necessarely key-value pairs, also called properties, key unique)
object object
immutable list tuple t="a",b,123 or
t=("a",b,123)
tuple
dynamic array, ordered, value not unique JSON array
["a","b","c","a"']
not supported, use lists instead vector
doubly-linked list, key not unique list [a,b,c,a] list
tree, sorted, key unique set {a,b,c} set
map, key unique dictionary (actually object)
{"a":"b", "c":"d"}
dictionary {"a":"b", "c":"d"} map

dynamic array: get realloc depending on its evolving size.
.