Skip to main content

Posts

Set up VNC login without console login in Ubuntu Gnome environment

 It is said that GNOME does not support VNC connection without logging in by default. So you have to do the following annoying task. 1) gnome-remote-desktop settings Open "Settings" in gnome-remote-desktop, select "Sharing", Find "Remote Desktop" or "Screen Sharing" and disable it.  2) Install x11vnc sudo apt update sudo apt install x11vnc 3) Set x11vnc password x11vnc -storepasswd 4) Set auto-start at boot (create x11vnc.service file) sudo nano /etc/systemd/system/x11vnc.service Contents
Recent posts

Setting ubuntu grub timeout when using efi

 # 1) Edit grub with vi sudo vi /etc/default/grub # 2) Add or modify the following part GRUB_RECORDFAIL_TIMEOUT="5" # 3) Update sudo update-grub The reason is If you look at "/etc/grub.d/00_header" if [ \$grub_platform = efi ]; then set timeout=${GRUB_RECORDFAIL_TIMEOUT:-30} if [ x\$feature_timeout_style = xy ] ; then set timeout_style=menu fi fi Because it's like this.

[WordPress] Change https redirect in DB.

If you make an https redirect without thinking about SSL configuration: Check DB SELECT * from wp_options where option_name IN ('siteurl', 'home'); Update UPDATE wp_options SET option_value = REPLACE(option_value, 'https://your_domain', 'http://your_domain') WHERE option_name IN ('siteurl', 'home');

Setup pyodbc for connecting mssql (with freeTDS)

@Windows 1. pip install pyodbc 2.  Install Windows ODBC driver:  https://learn.microsoft.com/en-us/sql/connect/odbc/download-odbc-driver-for-sql-server?view=sql-server-2016 @Linux (Ubuntu-base) 1. freeTDS install using apt apt-get install freetds-dev freetds-bin apt-get install tdsodbc Explanation tdsodbc => /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so freetds-dev freetds-bin => /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so and etc files 2.  edit or add in /etc/odbcinst.ini [FreeTDS] Description = FreeTDS ODBC Driver Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so FileUsage = 1 CPTimeout = CPReuse = Example code: import pyodbc connection_string = ( 'DRIVER={FreeTDS};' 'SERVER=1.2.3.4;' 'PORT=1433;' 'DATABASE=mydbname;' 'UID=myuser;' 'PWD=password;' 'TDS_Version=7.3;' # 'Encrypt=no;TrustServerCertificate=yes;Trusted_Connection=no;' )

[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

Linux/Process fork monitoring

ps_moniter.sh  #!/bin/bash . /etc/profile let LIMIT_PROCESS=400 let LIMIT_BIG_PROCESS=40 ALL_PROCESS_NUM=`ps x |wc -l` if [ ${ALL_PROCESS_NUM} -gt ${LIMIT_PROCESS} ]; then   echo ${ALL_PROCESS_NUM} fi BIG_PROCESS=`ps x -o cmd |sort  |uniq -c |sort -n |tail -n 10` BIG_PROC_SUM=`echo "${BIG_PROCESS}" |awk ' { SUM=SUM+$1 } END { print SUM } '` if [ ${BIG_PROC_SUM} -gt ${LIMIT_BIG_PROCESS} ]; then   MESSAGE="Process Report [Big Process Larger than ${LIMIT_BIG_PROCESS}] ${BIG_PROCESS}"   echo "$MESSAGE" fi crontab */5 * * * * cd /root/bin && ./ps_moniter.sh &>/dev/null