Skip to content

Instantly share code, notes, and snippets.

View burningsky250's full-sized avatar
🎯
Focusing

steven burningsky250

🎯
Focusing
View GitHub Profile
@burningsky250
burningsky250 / tree.md
Created November 18, 2016 09:07 — forked from hrldcpr/tree.md
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@burningsky250
burningsky250 / killcx
Created December 24, 2016 08:38 — forked from kisel/killcx
killcx
#!/usr/bin/perl
######################################################################
# killcx :
#
# Close a TCP connection under Linux.
#
# (c) Jerome Bruandet - <floodmon@spamcleaner.org>
#
# version 1.0.3 - 18-May-2011
#
@burningsky250
burningsky250 / SimpleHTTPServerWithUpload.py
Created December 26, 2016 15:05 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/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.
"""
@burningsky250
burningsky250 / install-gcc48-linuxbrew-centos6.md
Created March 31, 2017 17:53 — forked from stephenturner/install-gcc48-linuxbrew-centos6.md
Installing gcc 4.8 and Linuxbrew on CentOS 6

Installing gcc 4.8 and Linuxbrew on CentOS 6

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.

Resources:

@burningsky250
burningsky250 / python: function is descriptor.md
Last active June 7, 2017 06:45
python function is descriptor
>>> 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
@burningsky250
burningsky250 / get_export_list.md
Created June 8, 2017 17:15
get a list of names exported from given module(either from __all__ or inspect non-"_"-started global variables from the module)
>>> import json
>>> os._get_exports_list(json)
['dump', 'dumps', 'load', 'loads', 'JSONDecoder', 'JSONEncoder']
@burningsky250
burningsky250 / google_scholar
Created June 28, 2017 15:57 — forked from billryan/google_scholar
unbound configurations for google scholar
# 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"

Installing SSHPASS

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.

Installing on Ubuntu

apt-get install sshpass

Installing on OS X

@burningsky250
burningsky250 / update_curl.sh
Created July 28, 2017 15:55 — forked from matthijs2704/update_curl.sh
Update curl on Ubuntu 14.04
#! /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