Tuesday, September 27, 2016

ssh


  • avoid automatic time outs on sessions
    • GSSAPIAuthentication no
    • GSSAPIDelegateCredentials no
    • ServerAliveInterval 60
  • to run something on different machines:
    • for i in `seq 17 19`; do ssh xml$i sed -i '"s/boost_clicks=0.0/boost_clicks=10/"' my-search/depot/search/Whatever/etc/*/rank.conf ; done

    for i in 2 3 4 7 8 9 10 11 12 13 14 15 16
    do
    echo xml$i
    ssh toto@xml$i cat /etc/debian_version
    done

  • ssh users are Ubuntu users. There are no specific ssh users

  • to do ssh without entering a pw
    • ssh-copy-id user@server


Thursday, September 1, 2016

Python data types

------------------------ built in types

-- tuples (immutables)
> empty = ()
> t = 12345, 54321, 'hello!'
or
> t = (12345, 54321, 'hello!')
> t
(12345, 54321, 'hello!')

-- set

> a=set()

> a.add("orange")

> a
{'orange'}
> basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'}      # creates a set without duplicates
> basket.add("'orange")
> basket
{'orange', 'pear', 'apple', 'banana'}

>

> my_data = {0,0}

> my_data

{0}


-- list  (might contain different types, duplicates. It is mutable)
z_list = []
my_list = ["apple", "banana", "cherry"]
my_list.append("pear")
a_list=[0]
a_list = [66.25, 333, 333, 1, 1234.5]
a_list = ['foo', 'bar', 'bar']
a_list = [[ 4.9,  3. ,  1.4,  0.2], [ 4.9,  3. ,  1.4,  0.2]]

-- dictionaries (have keys)
> my_dict = {}

> d={0:0}

> d

{0: 0}

tel = {'jack': 4098, 'sape': 4139}
tel['john'] = 4444.  # add
print (tel.keys())         # returns a list
  dict_keys(['jack', 'sape', 'john'])
print (tel.values())      # returns a list
  dict_values([4098, 4139, 4444])

to see all variables.