Skip to content

Instantly share code, notes, and snippets.

View burningsky250's full-sized avatar
🎯
Focusing

steven burningsky250

🎯
Focusing
View GitHub Profile
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
@burningsky250
burningsky250 / dict_merge.py
Created November 15, 2017 05:18 — forked from angstwad/dict_merge.py
Recursive dictionary merge in Python
import collections
def dict_merge(dct, merge_dct):
""" Recursive dict merge. Inspired by :meth:``dict.update()``, instead of
updating only top-level keys, dict_merge recurses down into dicts nested
to an arbitrary depth, updating keys. The ``merge_dct`` is merged into
``dct``.
:param dct: dict onto which the merge is executed
:param merge_dct: dct merged into dct
#!/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
@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 \

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 / 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"
@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 / 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 / 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 / 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!