This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # views | |
| # Préparation d'un dict du type : | |
| # {'rubrique_1' : {}, 'rubrique_2' : {}} | |
| # Pour chaque clef : le sous-dict est | |
| # {'sous_rubrique_1' : [ligne_1, ligne_2, ...]} | |
| from collections import defaultdict | |
| data = defaultdict(dict) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| import string | |
| print(''.join([random.SystemRandom().choice("{}{}{}".format(string.ascii_letters, string.digits, string.punctuation)) for i in range(50)])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def firstn(n): | |
| num = 0 | |
| while num < n: | |
| yield num | |
| num += 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cat | ssh user@server 'cat - >> ~/.ssh/authorized_keys' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| import sys | |
| if sys.platform.startswith('linux'): | |
| try: | |
| import readline | |
| except ImportError: | |
| print "Module readline not available." | |
| else: | |
| import rlcompleter | |
| readline.parse_and_bind("tab: complete") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This file is part of PulseAudio. | |
| # | |
| # PulseAudio is free software; you can redistribute it and/or modify | |
| # it under the terms of the GNU Lesser General Public License as published by | |
| # the Free Software Foundation; either version 2 of the License, or | |
| # (at your option) any later version. | |
| # | |
| # PulseAudio is distributed in the hope that it will be useful, but | |
| # WITHOUT ANY WARRANTY; without even the implied warranty of | |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/pulseaudio -nF | |
| # | |
| # This file is part of PulseAudio. | |
| # | |
| # PulseAudio is free software; you can redistribute it and/or modify it | |
| # under the terms of the GNU Lesser General Public License as published by | |
| # the Free Software Foundation; either version 2 of the License, or | |
| # (at your option) any later version. | |
| # | |
| # PulseAudio is distributed in the hope that it will be useful, but |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Database name : db_name | |
| # Password : db_pwd | |
| CREATE DATABASE db_name; | |
| ALTER DATABASE db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; | |
| GRANT ALL ON db_name.* TO 'db_name_user'@'localhost' IDENTIFIED BY 'db_pwd'; | |
| FLUSH PRIVILEGES; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def create_and_write_file(filename, data): | |
| fd = open(filename, "w") | |
| if not fd: | |
| raise Exception("Unable to create %s. Check for read-write permissions." % filename) | |
| fd.write(data) | |
| fd.close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >>> from string import Template | |
| >>> s = Template('$who likes $what') | |
| >>> s.substitute(who='tim', what='kung pao') | |
| 'tim likes kung pao' |