Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
#!/usr/bin/perl | |
###################################################################### | |
# killcx : | |
# | |
# Close a TCP connection under Linux. | |
# | |
# (c) Jerome Bruandet - <floodmon@spamcleaner.org> | |
# | |
# version 1.0.3 - 18-May-2011 | |
# |
#!/usr/bin/env python | |
"""Simple HTTP Server With Upload. | |
This module builds on BaseHTTPServer by implementing the standard GET | |
and HEAD requests in a fairly straightforward manner. | |
""" |
The GCC distributed with CentOS 6 is 4.4.7, which is pretty outdated. I'd like to use gcc 4.8+. Also, when trying to install Linuxbrew you run into a dependency loop where Homebrew's gcc depends on zlib, which depends on gcc. Here's how I solved the problem.
Note: Requires sudo
privileges.
>>> class Foo(object):
... def method(self, a):
... pass
...
>>> object = Foo()
>>> object.method
<bound method Foo.method of <__main__.Foo object at 0x7f3f2e7cfed0>>
>>> def bar(self, a):
... print a
>>> import json
>>> os._get_exports_list(json)
['dump', 'dumps', 'load', 'loads', 'JSONDecoder', 'JSONEncoder']
# file: /etc/unbound/google_scholar | |
local-data: "scholar.google.cn AAAA 2607:f8b0:4005:80a::200e" | |
local-data: "scholar.google.com.hk AAAA 2607:f8b0:4005:80a::200e" | |
local-data: "scholar.google.com.sg AAAA 2607:f8b0:4005:80a::200e" | |
local-data: "scholar.google.com.tw AAAA 2607:f8b0:4005:80a::200e" | |
local-data: "scholar.google.com.uk AAAA 2607:f8b0:4005:80a::200e" | |
local-data: "scholar.google.com AAAA 2607:f8b0:4005:80a::200e" | |
local-data: "scholar.l.google.com AAAA 2607:f8b0:4005:80a::200e" |
SSHPass is a tiny utility, which allows you to provide the ssh password without using the prompt. This will very helpful for scripting. SSHPass is not good to use in multi-user environment. If you use SSHPass on your development machine, it don't do anything evil.
apt-get install sshpass
#! /usr/bin/env bash | |
# Install any build dependencies needed for curl | |
sudo apt-get build-dep curl | |
# Get build requirements | |
# Some of these are used for the Python bindings | |
# this package also installs | |
sudo apt-get install g++ make binutils autoconf automake autotools-dev libtool pkg-config \ | |
zlib1g-dev libcunit1-dev libssl-dev libxml2-dev libev-dev libevent-dev libjansson-dev \ |
#!/usr/bin/env python3 | |
# coding=utf-8 | |
import json | |
from ansible.executor.task_queue_manager import TaskQueueManager | |
from ansible.inventory import Inventory | |
from ansible.inventory.group import Group | |
from ansible.inventory.host import Host | |
from ansible.parsing.dataloader import DataLoader | |
from ansible.playbook.play import Play |