Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Thursday, July 16, 2020

Set up Google Cloud VM

Setup up ssh

https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys

Note:
$ ssh-keygen -t rsa -f ~/.ssh/[KEY_FILENAME] -C [USERNAME]


Set [USERNAME] for the same user.

Change root password

$ sudo passwd


Change user password

$ sudo passwd [USERNAME]

Install zsh

https://ohmyz.sh/

Graphical user interface (GUI) for Google Compute Engine instance

https://medium.com/google-cloud/linux-gui-on-the-google-cloud-platform-800719ab27c5
https://medium.com/google-cloud/graphical-user-interface-gui-for-google-compute-engine-instance-78fccda09e5c
https://help.realvnc.com/hc/en-us/articles/360003474792-Why-does-VNC-Server-in-Virtual-Mode-on-Linux-appear-to-hang-show-a-gray-screen-or-not-start-at-all-#using-vnc-5-x-or-vnc-connect-6-0-6-1-or-on-a-different-version-of-linux--0-1

Steps:
1. sudo apt install xfce xfce4-goodies vnc4server
2. change .vnc/xstartup to

#!/bin/sh
DESKTOP_SESSION=xfce
export DESKTOP_SESSION
startxfce4
vncserver-virtual -kill $DISPLAY


3. start vncserver
$ vncserver

4. stop vncserver
$ vncserver -kill :1

5. set firewall on Google VM by adding a rule with tag "vnc-server": https://console.cloud.google.com/networking/firewalls/list?_ga=2.140666673.226794997.1594947656-1741100383.1594947656&project=covid-19-283520&folder=&organizationId=
6. add "vnc-server" in "Network tag" in the VM instance
7. On local machine, install RealVNC

Friday, June 21, 2013

Install texlive 2012 on Ubuntu 12.04


sudo add-apt-repository ppa:texlive-backports/ppa
sudo apt-get update
sudo apt-get upgrade

Friday, May 10, 2013

How to change the title of an xterm

  • ESC]0;stringBEL – Set icon name and window title to string
  • ESC]1;stringBEL – Set icon name to string
  • ESC]2;stringBEL – Set window title to string
An xterm title of username@hostname: directory:
    echo -n "\033]0;${USER}@${HOST}\007"

For bash
    case $TERM in
        xterm*)
            PS1="\[\033]0;\u@\h: \w\007\]bash\\$ "
            ;;
        *)
            PS1="bash\\$ "
            ;;
    esac

For zsh
    case $TERM in
        xterm*)
            precmd () {print -Pn "\e]0;%n@%m: %~\a"}
            ;;
    esac

Friday, February 22, 2013

Mount Nikon D5100 on Ubuntu 12.10


0. install gphoto2 

1. lsusb

Bus 001 Device 003: ID 046d:c31c Logitech, Inc. Keyboard K120 for Business
Bus 002 Device 007: ID 04b0:0429 Nikon Corp.
Bus 002 Device 003: ID 03f0:a407 Hewlett-Packard
Bus 002 Device 004: ID 03f0:0d17 Hewlett-Packard LaserJet 1012


2. gvfs-mount "gphoto2://[usb,002,007]", with quotes
    002 is the Bus number, 007 is the Device number

3. check /run/user/[username]/gvfs or ~/.gvfs

Monday, February 18, 2013

How to install Fcitx on Kubuntu

  1. sudo apt-get install fcitx kde-config-fcitx fcitx-ui-classic fcitx-googlepinyin
  2. im-switch -s fcitx -z default
  3. fcitx -r
  4. run qtconfig, in "Interface", choose "Default Input Method" to "fcitx"

Saturday, December 15, 2012

Setup remote Git repository

suppose the remote server is username@foo.com
suppose the repository is xxx.git

1. set up remote git repository
$mkdir ~/git-rep
$cd ~/git-rep
$mkdir xxx.git
$cd xxx.git
$git init --bare


2. on your local machine, add a remote repository aliases
$git remote add [ALIASES_NAME] username@foo.com
# check
$git remote -v


3. push your copy to the remote repository
# check branch
$git branch
$git push [ALIASES_NAME] master


4. Undo git add before the first commit
$git rm -r --cached .

5. repo inside a repo
$git submodule add [URL]
$git submodule init
$git submodule update

Note:
if you got an error: "bash: git-receive-pack: command not found", try
$git push [ALIASES_NAME] master --receive-pack=[REMOTE_PATH]/git-receive-pack

to avoid it, dump enviroment in .ssh/environment
env > .ssh/environment

Please note that setting up PATH in either .bashrc and .bash_profile does NOT work!

Saturday, December 8, 2012

How to access Box.com files from Ubuntu 12.10?


1. sudo apt-get install davfs2

2. sudo dpkg-reconfigure davfs2

    In the screen select Yes

3. sudo cp -r /etc/davfs2/ ~/.davfs2

4. sudo chown -R [ubuntu username] ~/.davfs2/

5. edit ~/.davfs2/secrets. add this line at the end of the file:
    https://www.box.com/dav [box.com username] [box.com password]

6. edit ~/.davfs2/davfs2.conf. uncomment:
    use_locks 0

7. sudo adduser [ubuntu username] davfs2

8. mkdir ~/box.com

9. edit /etc/fstab. add this line at the end of the file:
     https://www.box.com/dav/ /home/[ubuntu username]/box.com davfs _netdev,rw,user 0 0

10. reload fstab
      mount -a

Wednesday, November 28, 2012

Install VirtualBox in Ubuntu 12.10


  1. echo "deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
  2. wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
  3. sudo apt-get update
  4. sudo apt-get install virtualbox-4.2

Wednesday, November 7, 2012

Sort Nautilus Bookmarks

If only locations are provided:

sort ~/.gtk-bookmarks -o ~/.gtk-bookmarks

If names are provided:

sort ~/.gtk-bookmarks -o ~/.gtk-bookmarks -k 2


Wednesday, October 31, 2012

Automatically change backgrounds in Xfce 4.10


  1. download a list of background pictures
  2. right click on the desktop, and choose "Desktop Settings..."
  3. under "Background" tab, choose "Image list" on the right
  4. click "+" to add background pictures to the list
  5. choose "Change the background (in minutes)", and adjust the minutes
  6. if you have one monitor, choose "Stretched" for "Style"; if you have two monitors, choose "Tiled", and choose "Stretch this background across all monitors"





Tuesday, October 30, 2012

Install Xfce 4.10 in Xubuntu 12.04

sudo add-apt-repository ppa:xubuntu-dev/xfce-4.10
sudo apt-get udpate
sudo apt-get dist-upgrade

Thursday, August 23, 2012

Inkscape doesn't open on ubuntu 12.04


inkscape keeps crashing while loading, and the error message doesn't give any hint.

Emergency save activated!
Emergency save completed. Inkscape will close now.
If you can reproduce this crash, please file a bug at www.inkscape.org
with a detailed description of the steps leading to the crash, so we can fix it.

The problem is that I substituted its icon in .icons. Then a conflict took place... Now, I've just undo that and inkscape return to work.

Sunday, May 27, 2012

Sunday, March 11, 2012

Wednesday, February 8, 2012