文章

顯示從 7月, 2022 起發佈的文章

[ubuntu] 1 sudo many commands

  sudo su -c "apt update && apt install php" but cd not work

mac os .iso files

 https://archive.org/details/macos-collection

[Windows] 1-command-install php+composer for laravel

cd $env:TEMP;Invoke-WebRequest https://github.com/techdesignism/1-command-install/raw/main/windows/win10/php8.1.8%2Bcomposer2.3.10%2Bvc_redist.x64_2022/php-8.1.8-Win32-vs16-x64.zip -O php.zip;Expand-Archive php.zip -DestinationPath C:/php;Copy-Item 'C:/php/php.ini-development' -Destination 'C:/php/php.ini';(Get-Content C:/php/php.ini) -Replace ';extension=openssl', 'extension=openssl' -Replace ';extension=curl', 'extension=curl' -Replace ';extension=gd', 'extension=gd' -Replace ';extension=mbstring', 'extension=mbstring' -Replace ';extension=pdo_mysql', 'extension=pdo_mysql' -Replace ';extension=pdo_sqlite', 'extension=pdo_sqlite' -Replace ';extension=sqlite3', 'extension=sqlite3' -Replace ';extension=fileinfo', 'extension=fileinfo'   | Set-Content C:/php/php.ini;$env:Path += ';C:/php';[Environment]::SetEnvironmentVariable("Path...

[docker/not in docker] setup php+composer+laravel environment in a ubuntu container in 1 command

docker apt update && apt install php ca-certificates git zip unzip php-zip curl php-curl php-xml wget -y && cd /tmp && wget https://getcomposer.org/installer -O composer-setup.php --no-check-certificate && wget https://composer.github.io/installer.sig --no-check-certificate && HASH=`cat installer.sig` && php -r "if (hash_file('SHA384', '/tmp/composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer not in docker sudo apt update && sudo apt install php ca-certificates git zip unzip php-zip curl php-curl php-xml wget -y && cd /tmp && wget https://getcomposer.org/installer -O composer-setup.php --no-check-certificate && wget https://composer.github.io/installer.sig --no-check-certi...

[ubuntu] install 7zip

 apt install p7zip-full p7zip-rar

[Alpine] ERROR: unable to select packages error docker on Alpine Linux

 vi  /etc/apk/repositories remove # and save

[Mac vbox] How to Fix VirtualBox Error: Kernel Driver Not Installed (rc=-1908)

  How to Fix VirtualBox Error: Kernel Driver Not Installed (rc=-1908) Step 1: Go to System Preferences Step 2: Navigate to Security and Privacy From  System Preferences :  Navigate to the   Security and Privacy  option.  Select the  General  tab. Step 3: Allow Oracle America, Inc. to Load Go to the  General  tab.  Look for the  System Software from Developer ‘Oracle America, Inc.’ was blocked from the loading  section.  Click the  Allow  button next to this text. Step 4: Restart VirtualBox After completing all the steps above and allowing Oracle America Inc. to work with your macOS,  reopen  VirtualBox . Now, try installing a virtual machine. If this doesn’t work, try restarting your Mac before you relaunch VirtualBox.

install docker in alpine (can do docker in docker)

  apk update && apk add docker docker-compose openrc && rc-update add docker boot && service docker start

[NAS] "Socket closed" error / cannot access novnc (with reverse proxy)

  The solution:   Go to "Control Panel" -> "Application Portal" -> "Reverse Proxy" -> Edit your reverse proxy record -> "Custom Header" tab -> "Create" dropdown -> "WebSocket" Okay/save out of there and the issue should be fixed.

Synology NAS 設定 proxy 將對外 80 port 轉導到指定 Docker 服務

  設定 proxy 前往 Proxy 設定頁面,路徑: Control Panel / Application Portal / Reverse Proxy Description: my-site # Source Protocol: Http Hostname: 申請的網域域名 Port: 80 # Destination Protocol: HTTP Hostname: localhost Port: 18000 (內部Docker container 啟動分配的 Port)

VirtualBox Linux Addition

use terminal to run .run file

[linux] apt download deb file and install it

  apt download novnc apt install ./novnc_filename.deb  --no-install-recommends works here too ( apt install ./novnc_filename.deb  --no-install-recommends )

docker save & load / wget+load

docker save techdesignism/lxde-vnc-novnc:0.2 | gzip --best > lxde-vnc-novnc.tar.gz docker load < lxde-vnc-novnc.tar.gz =========================================== wget http://link_of_file/ -O lxde-vnc-novnc_0.2.tar.gz && docker load < lxde-vnc-novnc_0.2.tar.gz

get root permission

  sudo su –

linux uninstall python

  To list all python versions in default locations ls /usr/bin/python* To remove just python3 package sudo apt-get remove python3.5 plus it's dependent packages sudo apt-get remove --auto-remove python3.5 plus configuration and/or data files of python3 sudo apt-get purge python3.5 both configuration and/or data files of python3.5 and it's dependencies sudo apt-get purge --auto-remove python3.5 How to install new version of python sudo apt-get update sudo apt-get install python3

linux list all python process(ps)

  ps -ef | grep python

Tor onion service 3 torrc

HiddenServiceDir /desired/path/to/hidden/service/config HiddenServiceVersion 3 HiddenServicePort <localport> <server> 

lxde-vnc-novnc dockerfile (have SSL https)

FROM techdesignism/lxde-vnc-novnc:0.1 EXPOSE 6080 ENV RESOLUTION=1200x600 ENV PASSWORD=12345678 ADD ./Dockerfile .lxde_vnc_settings_${RESOLUTION} ADD ./Dockerfile .lxde_vnc_settings_${PASSWORD} ADD ./cert.pem /etc/ssl/cert.pem ADD ./privkey.pem /etc/ssl/privkey.pem ENTRYPOINT echo ${PASSWORD} | vncpasswd -f > ~/.vnc/passwd && rm -rfv /tmp/.X* && USER=user vncserver -geometry ${RESOLUTION} && websockify -D --web=/usr/share/novnc/ --cert=/etc/ssl/cert.pem --key=/etc/ssl/privkey.pem 6080 localhost:5901 && bash docker build -t techdesignism/lxde-vnc-novnc-ssl:0.2 .

novnc SSL (old, new method is use Dockerfile)

 1. download your cert, 2 files: cert.pem & key.pem 2. upload the certs to /etc/ssl/ 3. start the docker container, and run command ps -ef|grep python|grep -v grep|cut -c 9-15|xargs kill -15 && websockify -D --web=/usr/share/novnc/ --cert=/etc/ssl/cert.pem --key=/etc/ssl/key.pem 6080 localhost:5901

linux kill all python

  ps -ef| grep python| grep -v grep |cut -c 9 - 15 |xargs kill - 15

Installing Asian Fonts on Ubuntu & Debian /docker

Example # sudo apt- get install language-pack-ja # To install Chinese language support, run following commands: Example  Code # sudo apt- get install language-pack-zh* # To install Korean language support, run following commands: Example  Code # sudo apt- get install language-pack-ko # apt install fonts-noto

lxde-vnc-novnc dockerfile (no SSL https)

FROM techdesignism/lxde-vnc-novnc:0.1 EXPOSE 6080 ENV RESOLUTION=1200x600 ENV PASSWORD=12345678 ADD ./Dockerfile .lxde_vnc_settings_${RESOLUTION} ADD ./Dockerfile .lxde_vnc_settings_${PASSWORD} ENTRYPOINT echo ${PASSWORD} | vncpasswd -f > ~/.vnc/passwd && rm -rfv /tmp/.X* && USER=user vncserver -geometry ${RESOLUTION} && websockify -D --web=/usr/share/novnc/ --cert=/etc/ssl/novnc.pem 6080 localhost:5901 && bash

tightvnc change password

echo 5678 | vncpasswd -f > ~/.vnc/passwd 5678 is the password

docker install chrome(chromium) & firefox

apt-get install --no-install-recommends chromium-browser  start chrome command: chromium-browser --no-sandbox ============================= apt-get install --no-install-recommends firefox

[docker] install lxde desktop and setup vnc server and novnc

apt update apt install --no-install-recommends lxde-core tightvncserver autocutsel nano xfonts-base USER=user vncserver (Would you like to enter a view-only password (y/n)? n) USER=user vncserver -kill :1 mv ~/.vnc/xstartup ~/.vnc/xstartup.bak nano ~/.vnc/xstartup #!/bin/bash xrdb $HOME/.Xresources /usr/bin/startlxde & /usr/bin/autocutsel -s CLIPBOARD -fork chmod +x ~/.vnc/xstartup rm -rfv /tmp/.X* USER=user vncserver -geometry 1200x600 apt install openssl cd /etc/ssl ; openssl req -x509 -nodes -newkey rsa:2048 -keyout novnc.pem -out novnc.pem -days 36500 chmod 644 novnc.pem apt-get install --no-install-recommends novnc websockify lxterminal apt-get remove gnome-screenshot gedit activity-log-manager xscreensaver system-config-printer pavucontrol lxtask websockify -D --web=/usr/share/novnc/ --cert=/etc/ssl/novnc.pem 6080 localhost:5901 rm /etc/xdg/autostart/lxpolkit.desktop mv /usr/bin/lxpolkit /usr/bin/lxpolkit.bak mv /usr/share/icons/Adwaita /usr/share/icons/Adwaita_ mv /usr/share...

linux command analyze storage usage(find big folders/files)

  du -aBM 2>/dev/null | sort -nr | head -n 50 | more

apt-get clean (clean apt cache for smaller docker image)

apt-get clean apt-get autoremove rm -rf /var/lib/apt/lists/* =========================================  https://linuxhint.com/why_apt_get_clean/ https://serverfault.com/questions/449726/what-is-the-purpose-of-the-files-in-this-directory-var-lib-apt-lists /var/lib/apt/lists/ Storage area for state information for each package resource specified in sources.list(5) Configuration Item: Dir::State::Lists. /var/lib/apt/lists/partial/ Storage area for state information in transit. Configuration Item: Dir::State::Lists (partial will be implicitly appended) du –sh /var/cache/apt/archives ^ this command check apt cache file size use no install recommends apt-get install --no-install-recommends something

lxsession-default-apps

  ~/.config/lxsession-default-apps/settings.conf

uninstall vi (vim.tiny)

  apt-get remove vim.tiny

linux terminal text edit tool size vs

  22 For common edit operations I prefer to install  vi  ( vim-tiny ), which uses only  1491 kB  or  nano  which uses  1707 kB . In other hand  vim  uses  28.9 MB . We have to remember that in order for  apt-get install  to work, we have to do the  update  the first time, so: apt-get update apt-get install vim-tiny To start the editor in  CLI  we need to enter  vi .

[mac] ssh

  ssh -p 24601  user@IP-Address 24601 is port number

[docker] install xubuntu desktop and setup vnc server and novnc

apt update apt install xfce4 xfce4-goodies tightvncserver USER=user vncserver USER=user vncserver -kill :1 mv ~/.vnc/xstartup ~/.vnc/xstartup.bak apt-get install vim apt install autocutsel vim ~/.vnc/xstartup #!/bin/bash xrdb $HOME/.Xresources startxfce4 & /usr/bin/autocutsel -s CLIPBOARD -fork chmod +x ~/.vnc/xstartup rm -rfv /tmp/.X* USER=user vncserver -geometry 1920x900 cd /etc/ssl ; openssl req -x509 -nodes -newkey rsa:2048 -keyout novnc.pem -out novnc.pem -days 36500 chmod 644 novnc.pem apt-get install novnc websockify websockify -D --web=/usr/share/novnc/ --cert=/etc/ssl/novnc.pem 6080 localhost:5901 http:// :6080/vnc.html

[Python] ffprobe or avprobe not found. Please install one

  installing the missing   ffmpeg   on ubuntu and debian: sudo apt-get install ffmpeg and macOS use the command: brew install ffmpeg

jupyter notebook command

 cd /root/Anaconda jupyter notebook --ip 0.0.0.0 --no-browser --allow-root --NotebookApp.token='12345678'

Docker/Linux Install curl

  apt-get update; apt-get install curl

[Windows] To start WSL, type bash at the Windows command prompt.

 type bash <Enter> at the Windows command prompt.

docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?. See 'docker run --help'.

 sudo service docker start

install Anaconda on Ubuntu/Docker

 cd /tmp curl -O https://repo.anaconda.com/archive/Anaconda3-2022.05-Linux-x86_64.sh bash Anaconda3-2022.05-Linux-x86_64.sh source ~/.bashrc =================================== docker path apt-get install -y libqt5gui5 /root/anaconda3/bin/anaconda-navigator /root/anaconda3/bin/jupyter notebook --allow-root ================ run in jupyter notebook commnad !/root/anaconda3/bin/pip install opencc

How can I use a local image as the base image with a dockerfile?

  You can use it without doing anything special. If you have a local image called   blah   you can do   FROM blah . If you do   FROM blah   in your Dockerfile, but   don't   have a local image called   blah ,   then   Docker will try to pull it from the registry. In other words, if a Dockerfile does  FROM ubuntu , but you have a local image called  ubuntu  different from the official one, your image will override it.

docker Linux Startup Shell Script (run when start shell/startup)

Method 1   /root/.bashrc vim ~/.bashrc ============================= Logout lxde: pkill -SIGTERM -f lxsession

[mac] gif2webp

 https://developers.google.com/speed/webp/download Synopsis gif2webp [options] input_file.gif -o output_file.webp Description gif2webp  converts a GIF image to a WebP image. Options The basic options are: -o string Specify the name of the output WebP file. If omitted,  gif2webp  will perform conversion but only report statistics. Using "-" as output name will direct output to 'stdout'. -- string Explicitly specify the input file. This option is useful if the input file starts with an "-" for instance. This option must appear  last . Any other options afterward will be ignored. If the input file is "-", the data will be read from 'stdin' instead of a file. -h, -help Usage information -version Print the version number (as major.minor.revision) and exit. -lossy Encode the image using lossy compression. -mixed Mixed compression mode: optimize compression of the image by picking either lossy or lossless compression for each frame heuristically. ...