Recent Pads - Page 32

Total pad count: 730
created 7 years, 59 days ago
d82ade78-1093-470b-993c-cdd69b497894

def make_tree(key_strings, delimeter):
    tree = {}
    for key_string in key_strings:
        keys = key_string.split(delimeter)
        for i, key in enumerate(keys):
            if i == 0:
                if key in tree:
... view all 30 lines

created 7 years, 60 days ago
6e9c84f0-8761-485e-a392-7a7a8710e4aa

def make_tree(parts):
    tree = {parts[-1]:True}
    parts.reverse()
    for part in parts:
        tree = {part:tree}
    return tree

... view all 11 lines

created 7 years, 60 days ago
improved-python-convert-list-into-a-nested-dict-tree

def make_tree(parts):
    tree = {parts[-1]:True}
    parts.reverse()
    for part in parts:
        tree = {part:tree}
    return tree

... view all 11 lines

created 7 years, 60 days ago
a4a32da6-0451-4c49-9f5c-7f4272797c87

def make_tree(parts):
    tree = {}

    current_node = tree

    for part in parts:
        current_node[part] = {}
... view all 12 lines

created 7 years, 60 days ago
python-convert-list-into-a-nested-dict-tree

def make_tree(parts):
    """
    this function accepts this type of list:
       ['blah','foo','2013','and','the','end']

    and returns this type of nested dict
        {'blah': {'foo': {'2013': {'and': {'the': {'end': True}}}}}}
... view all 30 lines

created 7 years, 60 days ago
asdlfkj-adsf-asdf-asdf-asdf-adsf-asd-fa-dsflijke

def make_tree(parts):
    """
    Create a dict tree out of a list, 
    I have never needed this pattern
    """
    newparts = []
    for part in parts:
... view all 27 lines

created 7 years, 68 days ago
salt-pillar-users-and-ssh-auth-keys

users:

  username1:
    uid: 1337
    gid: 1337
    crypt: asdlkfjasdflkjasd;lkfjasdf;lkjasdf;lkjasdf;lkajsdf;lkjasdf;lkjasdf
    pub_ssh_keys:
... view all 28 lines

created 7 years, 75 days ago
013df86f-d109-4e7b-861b-e4adcd9fd999

good for bootstrap
=====================

1 domain
100 webpages
5 specific instructions

... view all 41 lines

created 7 years, 77 days ago
44ced5da-89e5-4d90-9682-f875c4c497df

here is some text:

.. code-block:: python

  print("here is some code")

here is some text::
... view all 10 lines

created 7 years, 93 days ago
python-vs-java-md5-hexdigest

//# the PYTHON way
import sys
from hashlib import md5
for arg in sys.argv[1:]:
    print md5(arg).hexdigest()

//# The Java way ...
... view all 32 lines

created 7 years, 93 days ago
siena-asdiuna-ein3-98zj-a09vja-f09jvc

//# the PYTHON way

from hashlib import md5
md5().hexdigest()

//# The Java way ...

... view all 31 lines

created 7 years, 93 days ago
bfd33612-d0c1-4e8a-bfbf-91938c058c0a

# the python way
from hashlib import md5
md5().hexdigest()

# The java way ...

import java.security.MessageDigest;
... view all 30 lines

created 7 years, 93 days ago
8a0e7b23-4fbe-4857-828e-85ef58256f41

# The java way ...

import java.security.MessageDigest;
import java.math.BigInteger;

class MD5 {
    public String message;
... view all 30 lines

created 7 years, 105 days ago
2826417f-2cb5-4a9d-85d0-9cb1c9230c58

MASTER=master.foxhop.net # put your master here

sudo sed -i "s/#master: salt/#master: salt\nmaster: $MASTER/" /etc/salt/minion

sudo service salt-minion restart
... view all 6 lines

created 7 years, 109 days ago
79ec2fec-9b9b-46e5-b744-c527996c2c04

run-OFEDpackage-this-label-is-needed:
  cmd.run:
    - name: echo -e {{ OFEDpackage[-1] }}
    - cwd: /
... view all 4 lines

created 7 years, 109 days ago
httpwwwseosearchengineoptimizationseattlecomcambogia-garcinia-me

postfix:
  pkg:
    - installed
    - names:
      - postfix
  service:
    - running
... view all 43 lines

created 7 years, 109 days ago
217bb313-1ace-4f06-8465-6bfbc7447acd

  cost | requests |   ratio | market
 15.00 |   15,000 | $1:1000 | Good for development
 60.00 |   75,000 | $1:1250 | Better for freelancers
180.00 |  270,000 | $1:1500 | Best for production

  cost | requests |  ratio | market
 20.00 |    6,000 | $1:300 | Good for development
... view all 26 lines

created 7 years, 109 days ago
462e8e07-5002-4ff3-a658-f1ac5df0c988

  cost | requests |   ratio | market
 15.00 |   15,000 | $1:1000 | Good for development
 60.00 |   75,000 | $1:1250 | Better for freelancers
180.00 |  270,000 | $1:1500 | Best for production

  cost | requests |  ratio | market
 20.00 |    6,000 | $1:300 | Good for development
... view all 27 lines

created 7 years, 111 days ago
b6c75075-0967-4b21-b880-f6f9dd0861b2

>>> filesystems = ['root','var','opt','cars']
>>> for filesystem in filesystems:
...     print filesystem + ' . /'
...
root . /
var . /
opt . /
... view all 14 lines

created 7 years, 115 days ago
83152ee7-4d7f-45dc-9413-9b28b8afebb9

trac      1386     1  1386  1386  0 13:09 ?        00:00:00   /usr/bin/fetchmail -d 10 -f /etc/fetchmailrc --pidfile /apps/trac/gateway/fetchmail.pid --syslog
trac      1863  1386  1386  1386  0 13:11 ?        00:00:00     sh -c PYTHONPATH=/apps/trac/.env/lib/python2.6/site-packages:/apps/trac/.env/lib/python2.6/site-packages/distribute-0.6.15-py2.6.egg /apps/trac/data/internal_systems/plugin/bin/email2trac --project internal_systems
trac      1864  1863  1386  1386 40 13:11 ?        00:00:04       /usr/bin/python /apps/trac/data/internal_systems/plugin/bin/email2trac --project internal_systems
... view all 4 lines

pages 1 .. 30 31 32 33 34 .. 37