INSERT IGNORE INTO mytable
(primaryKey, field1, field2)
VALUES
('abc', 1, 2),
('def', 3, 4),
('ghi', 5, 6);
Use this command:
diff -qr --exclude=.svn dir1 dir2|sort
-q = print result only where files are different
-r = recursive
—exclude = use it if something has to be excluded
Use this snippet:
$trim = trim($text, " \xC2\xA0\n\t\r\0\x0B");
\xC2\xA0 is non-breaking space (alt+space in mac os x)
tar.gz:
$ tar -zcvf archive_name.tar.gz directory_to_compress
tar.bz2:
$ tar -jcvf archive_name.tar.bz2 directory_to_compress
Add parameter —exclude-dir to the grep command:
grep -R --exclude-dir=example_dir "something" *
VBoxManage clonehd "DiskToClone.vdi" "ClonedDisk.vdi"or
VBoxManage internalcommands setvdiuuid "CopiedDisk.vdi"
It depends on what platform you are on. The most common way to do this is by printing ANSI escape sequences. For a simple example, here is some python code:
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
def disable(self):
self.HEADER = ''
self.OKBLUE = ''
self.OKGREEN = ''
self.WARNING = ''
self.FAIL = ''
self.ENDC = ''
To use code like this, you can do something like:
print bcolors.WARNING + "Warning: No active frommets remain. Continue?" + bcolors.ENDCSource: http://stackoverflow.com/questions/287871/print-in-terminal-with-colors-using-python
Simply “print” show objects in ugly format. If you want to see object nice formatted use instruction below:
from pprint import pprint
data = data = [(1, {'a':'A', 'b':'B', 'c':'C', 'd':'D'}), (2, {'e':'E', 'f':'F', 'g':'G', 'h':'H', 'i':'I', 'j':'J', 'k':'K', 'l':'L'})]
pprint(data, indent=4, depth=3)
[ (1, { 'a': 'A', 'b': 'B', 'c': 'C', 'd': 'D'}),
( 2,
{ 'e': 'E',
'f': 'F',
'g': 'G',
'h': 'H',
'i': 'I',
'j': 'J',
'k': 'K',
'l': 'L'})]
The amount of indentation added for each recursive level is specified by indent; the default is one.
The number of levels which may be printed is controlled by depth. By default, there is no constraint on the depth of the objects being formatted.