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
> python fork.py | |
Parent here, I just created child 19478 | |
Child process up in this. |
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 os import fork | |
from time import sleep | |
# Fork the process | |
pid = fork() | |
if pid == 0: # We're in the child process | |
print "Child process up in this." | |
else: # We're in the parent process | |
print "Parent here, I just created child", pid |
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
- hosts: all | |
sudo: yes | |
vars: | |
cap_file: packet_capture_{{ ansible_hostname }}_{{ ansible_date_time['epoch'] }}.cap | |
tasks: | |
- name: start tcpdump | |
command: /usr/sbin/tcpdump -i eth0 -s 0 -w /tmp/${cap_file} | |
async: 60 | |
poll: 0 |
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
lex@server:~> python | |
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) | |
[GCC 4.4.3] on linux2 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import django | |
>>> django.get_version() | |
'1.4' |
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
the_str = """Four score and seven years ago our fathers brought forth upon this \ | |
continent a new nation, conceived in liberty and dedicated to the \ | |
proposition that all men are created equal...""" | |
def word_wrap(the_str, chars_per_line): | |
''' | |
Returns formatted string based on number of characters per line | |
''' | |
iterator,space_pos,line_count = 0,0,0 | |
output = the_str |
NewerOlder