This file contains 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/env python | |
import time | |
import subprocess | |
from syslog import syslog | |
def run(): | |
#cmd = ['ifconfig'] | |
cmd = ['ping', '-c', '3', 'google.com'] |
This file contains 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
sudo rabbitmqctl add_user tonyg changeit | |
sudo rabbitmqctl set_permissions tonyg ".*" ".*" ".*" |
This file contains 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/env python | |
import Queue | |
import json | |
import random | |
import time | |
import psutil | |
def random_message(): | |
"""create a dict of junk data, return as json""" |
This file contains 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/env python | |
import json | |
import random | |
import time | |
# replace Queue.Queue with multiprocessing.Queue | |
from multiprocessing import Process, Queue | |
def random_message(): |
This file contains 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/env python | |
import os | |
import subprocess | |
# > python subprocessdemote.py | |
# > sudo python subprocessdemote.py | |
def check_username(): |
This file contains 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 logging | |
import logging.handlers | |
log = logging.getLogger(__name__) | |
log.setLevel(logging.DEBUG) | |
handler = logging.handlers.SysLogHandler(address = '/dev/log') | |
formatter = logging.Formatter('%(module)s.%(funcName)s: %(message)s') |
This file contains 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
sudo pip install -e git+git://github.com/matplotlib/matplotlib.git#egg=matplotlib |
This file contains 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
function search_array() { | |
index=0 | |
while [ "$index" -lt "${#myArray[@]}" ]; do | |
if [ "${myArray[$index]}" = "$1" ]; then | |
echo $index | |
return | |
fi | |
let "index++" | |
done | |
echo "" |
This file contains 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
sudo bless -device /dev/disk0s4 -legacy -setBoot -nextonly | |
sudo shutdown -r now |
This file contains 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/env python | |
import json | |
import random | |
def build_rand_str(): | |
gen = '' | |
for i in range(8): | |
gen += random.choice('ABCDEFGH') | |
return gen |
OlderNewer