Monday, April 30, 2018

my .vimrc file

set nocompatible
        filetype off
        set rtp+=~/.vim/vundle.git/
        call vundle#rc()
        "Bundles:
        Bundle 'gmarik/vundle'
        Bundle 'jiangmiao/auto-pairs'
        Bundle 'Lokaltog/vim-powerline'
        Bundle 'scrooloose/syntastic'
        Bundle 'scrooloose/nerdcommenter'
        Bundle 'scrooloose/nerdtree'
        Bundle 'tmhedberg/SimpylFold'
       "
set number
set relativenumber
syntax on
set background=light
hi clear
syntax enable
colorscheme monokai
set shiftwidth=4
set tabstop=4
set expandtab
set laststatus=2

" searching
set hlsearch
set incsearch
set ignorecase
set smartcase
set showmatch

Friday, April 27, 2018

Python | Process text file and get word counts


import csv
import pandas as pd
import codecs
import jieba
import jieba.analyse

tag_list = list() # list of all tags

with codecs.open('soup.csv', 'r', 'utf-8') as f:
   
    for ln in f:

        item = ln.strip("\n\r").split("\t")

        tags = jieba.analyse.extract_tags(item[0])

        for t in tags:

            tag_list.append(t)

tagS = pd.Series(tag_list)

output = tagS.value_counts(ascending=False)

output.to_csv('output.csv', encoding='gbk')

Thursday, April 26, 2018

Thursday, April 12, 2018

Thursday, April 5, 2018

State names and abbreviations

states = {
        'AK': 'Alaska',
        'AL': 'Alabama',
        'AR': 'Arkansas',
        'AS': 'American Samoa',
        'AZ': 'Arizona',
        'CA': 'California',
        'CO': 'Colorado',
        'CT': 'Connecticut',
        'DC': 'District of Columbia',
        'DE': 'Delaware',
        'FL': 'Florida',
        'GA': 'Georgia',
        'GU': 'Guam',
        'HI': 'Hawaii',
        'IA': 'Iowa',
        'ID': 'Idaho',
        'IL': 'Illinois',
        'IN': 'Indiana',
        'KS': 'Kansas',
        'KY': 'Kentucky',
        'LA': 'Louisiana',
        'MA': 'Massachusetts',
        'MD': 'Maryland',
        'ME': 'Maine',
        'MI': 'Michigan',
        'MN': 'Minnesota',
        'MO': 'Missouri',
        'MP': 'Northern Mariana Islands',
        'MS': 'Mississippi',
        'MT': 'Montana',
        'NA': 'National',
        'NC': 'North Carolina',
        'ND': 'North Dakota',
        'NE': 'Nebraska',
        'NH': 'New Hampshire',
        'NJ': 'New Jersey',
        'NM': 'New Mexico',
        'NV': 'Nevada',
        'NY': 'New York',
        'OH': 'Ohio',
        'OK': 'Oklahoma',
        'OR': 'Oregon',
        'PA': 'Pennsylvania',
        'PR': 'Puerto Rico',
        'RI': 'Rhode Island',
        'SC': 'South Carolina',
        'SD': 'South Dakota',
        'TN': 'Tennessee',
        'TX': 'Texas',
        'UT': 'Utah',
        'VA': 'Virginia',
        'VI': 'Virgin Islands',
        'VT': 'Vermont',
        'WA': 'Washington',
        'WI': 'Wisconsin',
        'WV': 'West Virginia',
        'WY': 'Wyoming'
}

my-alpine and docker-compose.yml

 ``` version: '1' services:     man:       build: .       image: my-alpine:latest   ```  Dockerfile: ``` FROM alpine:latest ENV PYTH...