Skip to content

Instantly share code, notes, and snippets.

View harrifeng's full-sized avatar

Harri Feng harrifeng

View GitHub Profile
package main
import (
"net/http"
"os"
)
func main() {
shareFolder := "/share"
if len(os.Args) > 1 {
@harrifeng
harrifeng / choco.txt
Created October 15, 2018 06:06
Choco local list
autohotkey
cmder
git
github-desktop
GoogleChrome
nodejs
python
virtualbox
@harrifeng
harrifeng / install-tmux
Created October 8, 2018 07:10 — forked from suhlig/install-tmux
Install tmux 2.7 on rhel/centos 7
# Install tmux on rhel/centos 7
# install deps
yum install gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
curl -OL https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz
tar -xvzf libevent-2.1.8-stable.tar.gz
cd libevent-2.1.8-stable
./configure --prefix=/usr/local
@harrifeng
harrifeng / index.html
Created September 1, 2018 03:23
JS Bin [add your bin description] // source https://jsbin.com/xexivaw
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="[add your bin description]">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.7.2/redux.js" integrity="sha256-Ezb5Nri+VAO8xJDHLcPCxS70Kfh+MUFw9OXLZZrdfCs=" crossorigin="anonymous"></script>
</head>
<body>

Bento, a project by the same company that makes Chef, is a Packer-based project for building base boxes. Unlike http://vagrantbox.es, Bento just uses base operating systems from the manufacturers with no pre-installed software. All the boxes are hosted on S3 in the following format:

https://opscode-vm-bento.s3.amazonaws.com/vagrant/PROVIDER/opscode_OS-VERSION_chef-provisionerless.box

For example, Ubuntu 13.04 lives here for VirtualBox:

https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-13.04_chef-provisionerless.box

And the VMWare equivalent box lives:

def display(one):
print(type(one))
display(1)
display(i for i in range(32))
# <===================OUTPUT===================>
import logging
from logging.handlers import RotatingFileHandler
log_formatter = logging.Formatter('%(asctime)s %(levelname)s %(funcName)s(%(lineno)d) %(message)s')
logFile = '/tmp/demo.log'
my_handler = RotatingFileHandler(logFile, mode='a', maxBytes=5*1024*1024,
backupCount=2, encoding=None, delay=0)
my_handler.setFormatter(log_formatter)
>>> int('f', 16)
15
>>> hex(15)
'0xf'
a = bytes.fromhex('C3 A9')
u = a.decode('utf8')
print(u)
6.10.2. Membership test operations¶
The operators in and not in test for membership. x in s evaluates to True if x is a member of s, and False otherwise. x not in s returns the negation of x in s. All built-in sequences and set types support this as well as dictionary, for which in tests whether the dictionary has a given key. For container types such as list, tuple, set, frozenset, dict, or collections.deque, the expression x in y is equivalent to any(x is e or x == e for e in y).
For the string and bytes types, x in y is True if and only if x is a substring of y. An equivalent test is y.find(x) != -1. Empty strings are always considered to be a substring of any other string, so "" in "abc" will return True.
For user-defined classes which define the __contains__() method, x in y returns True if y.__contains__(x) returns a true value, and False otherwise.
For user-defined classes which do not define __contains__() but do define __iter__(), x in y is True if some value z with x == z is produced while iterat