Other articles


  1. Kafka note

    Changing from user to superuser: sudo su

    bin/zookeeper-server-start.sh config/zookeeper.properties
    bin/kafka-server-start.sh config/server.properties
    

    should be run in two terminals

    found port 2181 used, kill the program run on port 2181

    env | grep JAVA
    JAVA_HOME=/opt/jdk/jdk1.8.0_181 ...
    read more
  2. Convert pic to txt

    Look at my nyanko sensei picture! かわいい~~

    cat

    # -*- coding: utf-8 -*-
    from PIL import Image
    
    grey2char = ['@', '#', '$', '%', '&', '?', '*', 'o', '/', '{', '[', '(', '|', '!', '^', '~', '-', '_', ':', ';', ',',
                 '.', '`', ' ']
    count = len(grey2char)
    
    
    def toText(image_file):
        image_file = image_file.convert('L')  # 转灰度
        result = ''  # 储存字符串
        for h in range(0, image_file.size[1]):  # height
            for w in range(0, image_file.size[0]):  # width
                gray = image_file.getpixel ...
    read more
  3. install devstack

    adduser stack sudo visudo Find the part of the file that is labeled "User privilege specification" and change it to the following

    User privilege specification root ALL=(ALL:ALL) ALL stack ALL=(ALL:ALL) ALL Close the file, exit and log in as "stack". Download devstack and create /opt/stack ...

    read more
  4. Download Bird

    import requests
    from bs4 import BeautifulSoup
    from urlparse import urljoin
    import re
    
    
    def generate_url_list(input_url):
        r = requests.get(input_url)
        soup = BeautifulSoup(r.content, 'html.parser')
    
        page_list = []
        for link in soup.select('a > img'):
            if "org" in link.parent.get("href"):
                page_list.append(link.parent.get("href"))
                continue
            page_list.append("http ...
    read more
  5. Method of Python

    Method of List

    Method Name Use Explanation
    append alist.append(item) Adds a new item to the end of a list
    insert alist.insert(i,item) Inserts an item at the ith position in a list
    pop alist.pop() Removes and returns the last item in a list
    pop alist ...
    read more
  6. Use Pelican and GitHub Page to create blog

    This is a test

    Code blocks must be indented by 4 whitespaces. Python-Markdown has a auto-guess function which works pretty well:

    print("Hello, World")
    # some comment
    for letter in "this is a test":
        print(letter)
    

    In cases where Python-Markdown has problems figuring out which programming language we use, we can ...

    read more

Page 1 / 1

blogroll

social