Edited, memorised or added to reading queue

on 09-Oct-2018 (Tue)

Do you want BuboFlash to help you learning these things? Click here to log in or create user.

Flashcard 3415659384076

Question
In linux, to move/copy a file/dir, what two flags should you always include to keep the file permissions/symlinks, etc intact (use the flags on cp for the answer)?
Answer
cp -pd
^^ p is to preserve mode, ownership, timestamps, and d is to preserve links (no de-reference)

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
4. Basic Commands
er. The cp command also takes the -R option, allowing it to copy whole directories. The mv command is used to move files and directories. It really just renames a file to a different directory. <span>Note that with cp you should use the option -p and -d with -R to preserve all attributes of a file and properly reproduce symlinks (discussed later). Hence, always use cp -dpR <dir> <newdir> instead of cp -R <dir> <newdir> . 4.6 Relative vs. Absolute Pathnames Commands can be given file name







Flashcard 3415663316236

Question
In linux, aside from the man command, the [...] command also contain some excellent reference and tutorial information in hypertext linked format, but not all commands are covered.
Answer
info

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
4. Basic Commands
ly contain. Man pages are referenced with notation like cp (1), for the cp command in Section 1, which can be read with man 1 cp . This notation will be used from here on. 4.8 System info Pages <span>info pages contain some excellent reference and tutorial information in hypertext linked format. Type info on its own to go to the top-level menu of the entire info hierarchy. You can also type info <command> for help on many basic commands. Some packages will, however, not h







Flashcard 3415667510540

Question
In linux, [...] is the command to activate the calculator program.
Answer
bc

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
4. Basic Commands
igate and search documentation. Inside info, typing will invoke the help screen from where you can learn more commands. 4.9 Some Basic Commands You should practice using each of these commands. <span>bc A calculator program that handles arbitrary precision (very large) numbers. It is useful for doing any kind of calculation on the command-line. Its use is left as an exercise. cal [[0-1







Flashcard 3415670131980

Question
In Linux, issue command to find out how much disk space is being used by the user home directory?
Answer
du -sh ~
^^ the -s is for summary and just gives total disk usage of home dir and all its subdirs, without listing each sub dir one by one

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
4. Basic Commands
y on different computers. Run man dircmp (that is, dircmp (1)). (This is a System 5 command and is not present on LINUX. You can, however, compare directories with the Midnight Commander, mc ). <span>du <directory> Stands for disk usage and prints out the amount of space occupied by a directory. It recurses into any subdirectories and can print only a summary with du -s <direc







Flashcard 3415673277708

Question
In linux, the [...] command will tell you the type of a file based on the first few bytes of its content (aka its magic numbers).
Answer
file

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
4. Basic Commands
on expression . Most arithmetic operations that you are accustomed to will work. Try expr 5 + 10 '*' 2 . Observe how mathematical precedence is obeyed (i.e., the * is worked out before the + ). <span>file <filename> Prints out the type of data contained in a file. file portrait.jpg will tell you that portrait.jpg is a JPEG image data, JFIF standard . The command file detects an eno







Flashcard 3415676423436

Question
In Linux, you have a file called, test.txt, how do you output the first 20 lines of this file?
Answer
head -n 20 test.txt

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
4. Basic Commands
ory that exists on disk. It is obviously slow to access but provides the illusion of much more available RAM and avoids the possibility of ever running out of memory (which can be quite fatal). <span>head [-n <lines>] <filename> Prints the first <lines> lines of a file or 10 lines if the -n option is not given. (See also tail below). hostname [<new-name>] With no







Flashcard 3415679569164

Question
In Linux, you have lots of lines created by output of "ls -l /bin/", so type command to best view the output page by page?
Answer
ls -l /bin/ | less

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
4. Basic Commands
tries. The second command views the file. Use the space bar to page through the file. When you get bored, just press . You can also try ls -l /bin | more which will do the same thing in one go. <span>less The GNU version of more , but with extra features. On your system, the two commands may be the same. With less , you can use the arrow keys to page up and down through the file. You can







Flashcard 3415683501324

Question
In Linux, [...] is the GNU version of more, but with extra features (like arrow up and down usage, etc).
Answer
less

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
4. Basic Commands
. The second command views the file. Use the space bar to page through the file. When you get bored, just press . You can also try ls -l /bin | more which will do the same thing in one go. less <span>The GNU version of more , but with extra features. On your system, the two commands may be the same. With less , you can use the arrow keys to page up and down through the file. You can do searches by pressing , and then typing in a wor







Flashcard 3415687695628

Question
In python, if you want to count the occurrences of like items in a sequence; for example count the occurrences of words in a body of text, it is best to use what data structure?
Answer
dictionary

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3415690841356

Question
In python, if you have a dictionary, called count, which has each word in a book as its key, and the number of occurances of that word as its value, how do you create a second dictionary, count2, which is just the dictionary of words that appear between 15 and 20 times in the book (use dictionary comprehension)?
Answer
count2 = { key:value for key, value in count.items() if value <= 20 and value >= 15 }

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3415695559948

Question
In python, [...] are unordered collections of unique items
Answer
sets

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3415698705676

Question
In python, there are two types of sets, immutable and mutable, the immutable set is called [...]
Answer
frozenset

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3415701851404

Question
In python, how do you create an empty mutable set, s?
Answer
s = set()
^^ note s = {}, whould NOT work as it would create an empty dictionary

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3415704997132

Question
In python, you have set, s, returns the number of elements in s.
Answer
len(s)

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3415708142860

Question
In python, you have set, s={1,2,3}, how do you create a second set, s2, that is copy of s but you can change independently of s?
Answer
s2 = s.copy()

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3415711288588

Question
In python, you have sets, s={1,2,3} and t={3,4,5}, return a set, u, of all items in s but not in t (i.e. {1,2} )
Answer
u = s.difference(t)

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3415714434316

Question
In python, you have sets, s={1,2,3}, t={3,4,5}, return a set, u, of all items in both t and s (so u has value {3} )
Answer
u = s.intersection(t)

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3415717580044

Question
In python, you have two sets, s and t, check if s and t have no items in common.
Answer
s.isdisjoint(t)
^^ returns True

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3415720725772

Question
In python, you have sets, s={1}, t={1,2,3}, check (expect True) if all items in s are also in t
Answer
s.issubset(t)

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3415723871500

Question
In python, you have sets, s={1,2,3} and t={1}, check (expect True) if all items in t are also in s.
Answer: s. [...] (t)
Answer
s.issuperset(t)

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3415727017228

Question
In python, you have sets, s={1,2,3}, t={3,4,5}, return a set, u, of all items in s or t (i.e. {1,2,3,4,5})
Answer
u = s.union(t)

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3415730162956

Question
In python, you have sets, s={1,2,3} and t={3,4,5}, returns a set, u, of all items that are in s or t, but not both (i.e. {1,2,4,5} ).
Answer
u = s.symmetric_difference(t)

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3415734095116

Question
In python, you have set, s = {1,2,3}, add item 'a' to s (so s ends up as {1,2,3,'a'} ).
Answer
s.add('a')

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3415739600140

Question
In python, you have sets, s= {1,2,3} and t={3,4,5}, remove all items in s that are also in t (i.e. s ends up as {1,2} ).
Answer
s.differenece_update(t)

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3415742745868

Question
In python, you have sets, s={1,2,3,4} and t={3,4,5}, remove all items from s that are not in the intersection of s and t (i.e. s ends up as {3, 4} )
Answer
s.intersection_update(t)

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3415745891596

Question
In python, you have set, s = {1,2,3}, remove 3 from s (so s ends up as {1,2} ).
Answer
s.remove(3)

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3415749037324

Question
In python, you have sets, s={1,2,3} and t={3,4,5}, call method on s so s ends up as {1,2,4,5}
Answer
s.symmetric_difference_update(t)

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3415752183052

Question
In python, you have sets, s = {1,2,3,4} and t = {3,4,5}, what is the value of s after you do s.symmetric_difference_update(t)?
Answer
{1,2,5}

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3415755328780

Question
In python, you have set, s = {1,2,3}, how do you adds all the items of list, l=[4,5,6] to s (so s ends up as {1,2,3,4,5,6} )?
Answer
s.update(l)

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3415758474508

Question
In python, the set object (for example s={1,2,'a',(1,2)} ) does not care that its members are not all of the same type as long as they are all [...]
Answer
immutable

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3415761620236

Question
In python, [...] types all have a hash value that does not change throughout the lifetime of the instance
Answer
hashable

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3415764765964

Question
In python, all built-in immutable types are [...] while all mutable types are not.
Answer
hashable

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3415767911692

Question
In python, frozenset is useful in place of a set in 2 cases, when you want to add a set to another set (since frozenset is immutable) and [...]
Answer
when you want to make a set the key to a dictionary

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 3415771057420

Question
In python, frozenset is useful in place of a set in 2 cases, when you want to make a set a key to a dictionary (since its immutable) and [...]
Answer
when you want to add a set to another set

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs