From 3f26eb738edce3a33f51ae015c55e980372a3bc9 Mon Sep 17 00:00:00 2001 From: AceVest Date: Tue, 19 Jan 2021 13:25:00 +0800 Subject: [PATCH] ... --- learn/doc/vimrc | 6 +++--- learn/doc/zshrc | 3 ++- tools/comm/Makefile | 2 +- tools/comm/bitpic.go | 6 ++++-- tools/comm/int2ip | 28 ++++++++++++++++++++++++++++ 5 files changed, 38 insertions(+), 7 deletions(-) create mode 100755 tools/comm/int2ip diff --git a/learn/doc/vimrc b/learn/doc/vimrc index 1758d37..47c7b76 100644 --- a/learn/doc/vimrc +++ b/learn/doc/vimrc @@ -115,13 +115,13 @@ imap jj filetype off set rtp+=~/.vim/bundle/Vundle.vim -"call vundle#begin() +call vundle#begin() "Plugin 'VundleVim/Vundle.vim' -"Plugin 'fatih/vim-go' +Plugin 'fatih/vim-go' "Plugin 'Valloric/YouCompleteMe' "Plugin 'Lokaltog/vim-powerline' "Plugin 'scrooloose/nerdtree' -"call vundle#end() +call vundle#end() filetype plugin indent on " youcompleteme插件相关配置 diff --git a/learn/doc/zshrc b/learn/doc/zshrc index ee3c8fc..ab11d1c 100644 --- a/learn/doc/zshrc +++ b/learn/doc/zshrc @@ -1,5 +1,6 @@ # If you come from bash you might have to change your $PATH. # export PATH=$HOME/bin:/usr/local/bin:$PATH +export PATH=$HOME/go/bin:$PATH # Path to your oh-my-zsh installation. export ZSH="/Users/ace/.oh-my-zsh" @@ -78,7 +79,6 @@ ZSH_THEME="zhaoyanbai" plugins=( git zsh-autosuggestions -# incr ) source $ZSH/oh-my-zsh.sh @@ -133,3 +133,4 @@ export PATH=$PATH:$HOME/Library/Arduino15/packages/arduino/tools/avrdude/6.0.1-a export PATH=$PATH:/usr/local/opt/go/libexec/bin export PATH=$PATH:/Users/ace/sys/gnu-mcu-eclipse/riscv-none-gcc/8.2.0-2.2-20190521-0004/bin export RTOS_PATH=$HOME/workspace/acecode/rtos/ + diff --git a/tools/comm/Makefile b/tools/comm/Makefile index 140f39d..a550417 100644 --- a/tools/comm/Makefile +++ b/tools/comm/Makefile @@ -1,7 +1,7 @@ CC = gcc CPP = g++ BINS = countc htc -SCRIPTS = cls cs +SCRIPTS = cls cs int2ip DST = $(HOME)/.local/bin/ %.o : %.c diff --git a/tools/comm/bitpic.go b/tools/comm/bitpic.go index 11bf45c..25ec435 100644 --- a/tools/comm/bitpic.go +++ b/tools/comm/bitpic.go @@ -13,7 +13,8 @@ import ( "fmt" "image" "image/color" - "image/jpeg" + "image/png" + //"image/jpeg" "log" "os" ) @@ -100,5 +101,6 @@ func main() { f, err := os.OpenFile(dst, os.O_WRONLY|os.O_CREATE, 0600) defer f.Close() - jpeg.Encode(f, img, nil) + //jpeg.Encode(f, img, nil) + png.Encode(f, img) } diff --git a/tools/comm/int2ip b/tools/comm/int2ip new file mode 100755 index 0000000..cea1a94 --- /dev/null +++ b/tools/comm/int2ip @@ -0,0 +1,28 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# ------------------------------------------------------------------------ +# File Name: int2ip +# Author: Zhao Yanbai +# 2021-01-19 13:14:17 Tuesday CST +# Description: none +# ------------------------------------------------------------------------ + + +import socket +import struct +import sys + +if len(sys.argv) == 1 : + print("{0} ...".format(sys.argv[0])) + +for ipint in sys.argv[1:] : + try : + ipint = int(ipint) + except : + print("{0}: is not digital".format(ipint)) + continue + + ip1 = socket.inet_ntoa(struct.pack('I',ipint)) + ip2 = socket.inet_ntoa(struct.pack('I',socket.htonl(ipint))) + + print("{0}: {1} {2}".format(ipint, ip1, ip2)) -- 2.44.0