Skip to main content

Posts

Showing posts with the label linux

[Linux/k8s] set faking hyper-v uuid on k8s woker node

* conclusion     Unable to create weave-net (pod-to-pod connection) which works well with conflicting uuid. So in the end i reinstalled ubuntu in hyper-v (not import mode). remap-uuid.sh #!/bin/bash function make_bind_or_copy() {   if [ "$3" == "bind" ]; then     echo "MountBind $1 > $2"     mount -o ro,bind "$1" "$2"   else # copy     echo "Copy $1 > $2"     cp "$1" "$2"   fi } function make_newID() {   TITLE="$1"   ORG_FILE="$2"   TAR_FILE="$3"   BIND_MODE="$4"   if -f [ -f $TAR_FILE ]; then     make_bind_or_copy "${TAR_FILE}" "${ORG_FILE}" "${BIND_MODE}"     return   fi   CUR_ID=`cat ${ORG_FILE}`   echo "Current   ${TITLE}: ${CUR_ID}"   echo -n "Write New ${TITLE}: "   read NEW_ID   echo "Inputed   ${TITLE}: ${NEW_ID}"   echo "${NEW_ID}" > ${TAR_FILE}   echo -n "Re-Write(mount) ${OR

using docker.io/licensefinder/license_finder, and solve erros.

My errors npm ERR! peer dep missing: acorn@^6.0.0, required by acorn-dynamic-import@4.0.0 npm ERR! extraneous: ajv@6.9.1 /scan/node_modules/@angular-devkit/build-webpack/node_modules/ajv Try follows 1) npm install -g npm-check-updates 2) ncu -u 3) npm install 4) npm dedupe 5) npm prune --production 1),2),3) upgrade packages to lastest 4) remove duplicated packages 5) prune for removing extraneous

[Linux/BashScript/Vim] Encrypted vim file, cat util.

cat_vim_file.sh =============== #!/bin/bash usage() {   echo "$1 <filename>" } FILENAME=$1 if [ "$FILENAME" == "" ]; then   usage $0 elif [ -f ${FILENAME} ]; then   echo -n "EnterPassword:"   # Without echo (-s)   read -s szPassword   echo $szPassword| vim -es '+%print' '+:q!' $FILENAME else   echo "FileNotFound: $FILENAME"   usage $0 fi =============== Reference: https://stackoverflow.com/questions/3980668/how-to-get-a-password-from-a-shell-script-without-echoing

Ubuntu xrdp settings

Base : Ubuntu 18.04 Command of xrdp session restart -  systemctl restart xrdp-sesman.service /etc/xrdp/startwm.sh Example (For session bus error exception : unset.) ============ unset SESSION_MANAGER unset DBUS_SESSION_BUS_ADDRESS if test -r /etc/profile; then #xrdp multiple users configuration  . /etc/profile fi xfce-session mate-session if test -r /etc/default/locale; then         . /etc/default/locale         test -z "${LANG+x}" || export LANG         test -z "${LANGUAGE+x}" || export LANGUAGE         test -z "${LC_ADDRESS+x}" || export LC_ADDRESS         test -z "${LC_ALL+x}" || export LC_ALL         test -z "${LC_COLLATE+x}" || export LC_COLLATE         test -z "${LC_CTYPE+x}" || export LC_CTYPE         test -z "${LC_IDENTIFICATION+x}" || export LC_IDENTIFICATION         test -z "${LC_MEASUREMENT+x}" || export LC_MEASUREMENT         test -z "

[Linux/Grep] How to find hangul or japanese characters in soruce code

Following scripts offer you that finding Hangul, Katakana, Hiragana, Ganji(Han), Hiragana in your source code (ts file) "^((?!\/\/).)*"means that ignore "// comments". The script uses " property-name" of  Regular Expressions. #!/bin/bash BASE_SRC_FOLDER=../src IGNORE_FILE_POSTFIX=( "spec.ts" ) #GREP_PATTERN="^((?!\/\/).)*(\p{Hiragana}|\p{Han}|\p{Katakana})" # for Japanse GREP_PATTERN="^((?!\/\/).)*\p{Hangul}.*" # for Hangul CUR_DIR=`pwd` if [ "`basename $CUR_DIR`" != "script" ]; then   echo "Error: you must run `basename $0` in script directory."   exit fi echo "Search predefined characters in ts file of ${BASE_SRC_FOLDER} folder." TS_FILE_LIST=`find ${BASE_SRC_FOLDER} -name "*.ts"` for CUR_FILE in $TS_FILE_LIST do   let IS_RUN=1   for CUR_IGNORE_FILENAME in ${IGNORE_FILE_POSTFIX[@]}   do     if [ "${CUR_FILE%${CUR_IGNORE_FILENAME}}" != ${CUR

[bash-script/gcc] check warning of make within git-diff of commit

When you need check "make warning" in specific commits, you can use this script to check just in some commits. This script takes some steps. step1. You must know your commit hash. : like abcd1234 step2. Checkout to your commit.  Like this, git checkout abcd1234. step3. You need output file that run make.  Try to run command "make &> myoutput" step4. Then run this. ./new_warning.sh abcd1234 myoutput You can download this script :  new_warning.sh

[Excel] linux time result calulate

  B5: real+user+sys B5: =(LEFT(B2,FIND("m",B2)-1)*60+MID(B2, FIND("m",B2)+1,5))+(LEFT(B3,FIND("m",B3)-1)*60+MID(B3, FIND("m",B3)+1,5))+(LEFT(B4,FIND("m",B4)-1)*60+MID(B4, FIND("m",B4)+1,5))

[scapy] Linux-Cooked pcap to ethernet

# The pcap file formatted by "Linux cooked" # tcpdump -r myfile.pcap -nn reading from file event1.pcap, link-type LINUX_SLL (Linux cooked) ... ... # step1. read myfile.pcap pkts = rdpcap("myfile.pcap"); # step2. read myfile.pcap pkts = [Ether(src='00:11:22:33:44:55', dst='22:33:44:55:66:77')/pkt[1:] for pkt in pkts] # step3. modify IP address and recalculate chksum for pkt in pkts:  pkt[1].dst='192.168.1.10';  pkt[1].src='192.168.1.1';  del pkt[IP].chksum  del pkt[UDP].chksum # step4. packet send sendp(pkts[0]); # step5. save pcap  wrpcap("output.pcap",pkts); # tcpdump -r output.pcap -nn reading from file output.pcap, link-type EN10MB (Ethernet) ... ... # pkt[1:] : It means IP layer 1) Before: Linux cooked / IP / UDP / UDP-Data 2) After: Ethernet / IP / UDP / UDP-Data

[Linux/vi] multi search string

[1stString] : First string to find. [2ndString] : Second string to find Or Search ( Use "\|" ) /[1stString]\|[2ndString] And Search (Use ".*" ) /[1stString].*[2ndString]/ Reference: http://www.linuxquestions.org/questions/linux-software-2/searching-multiple-patterns-through-vi-editor-725155/