Tại sao…

Advertisements

Admesh, an .OFF file converter

Download the latest version here: https://github.com/admesh/admesh

Due to a different interpretation of how an OFF should be written. Geomview indexes vertices starting at zero, while some other programs are known to start at one. The following C program will convert a plain one-indexed OFF to a zero-indexed OFF.

This software can do it properly, don’t waste time finding another software, this is the only one works for me.

 

After the installation, you may have to edit

~/.bashrc

to make the software work globally because the library is not globally defined.

Add this on top of the file:

export LD_LIBRARY_PATH="/lib:/usr/lib:/usr/local/lib"

Then reboot the system.


To convert the .stl file to .off file, run this command:

admesh –write-off=[name of the off file] [the source file]

ex: admesh –write-off=model.off model.stl

Then you can open the off file with geomview.

 

What if your screen suddenly change to lower resolution, here is the short script to set it back.

Sometimes, it happens that your external monitor is quite old, and the system couldn’t recognize your monitor and flash it back to 1024×768. How do you fix it?

Create a .sh file that can run sequence of commands and put it at any place you want.

This case, my monitor supports max 1440×900 at 60Hz, so I create a file, say xrandr.sh, run this file on terminal and your nice resolution will be back:

#!/bin/bash
sudo xrandr –newmode “1440x900_60.00” 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync
sudo xrandr –addmode VGA-1 1440x900_60.00
xrandr –output VGA-1 –mode 1440x900_60.00

Add a package in emacs when couldn’t find in local package-install list

The following has been tested to work on an emacs -Q session:

  1. Launch emacs -Q
  2. Add the below in the scratch buffer:
    (require 'package)
    (add-to-list 'package-archives
     '("melpa" . "http://melpa.org/packages/") t)
  3. Evaluate the buffer (M-x eval-buffer)
  4. Do M-x package-install RET auto-complete RET
    The package will install.

How to install Nvidia driver for dual graphic card laptop (Sony SVS)

There are some steps you have to do before installing the driver of nvidia for your card.

1. Check if your Ubuntu is running with the dedicated graphic card or internal graphic card.
– System setting -> Details

– Run this command lspci | grep VGA in Terminal to see if your laptop support dual

$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
01:00.0 VGA compatible controller: NVIDIA Corporation GK107M [GeForce GT 640M LE] (rev a1)

2. To avoid the loop login after install  the nvidia driver. Run these:

$ sudo apt install mokutil
$ sudo mokutil --disable-validation

This problem was caused due to secure boot and EFI_SECURE_BOOT_SIG_ENFORCE in linux kernel 4.4.0-20 and later.

3. Check the latest nvidia driver with this command, pick the one that recommended:

$ sudo ubuntu-drivers devices
[sudo] password for cuongtd: 
== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
model : GK107M [GeForce GT 640M LE]
modalias : pci:v000010DEd00000FD3sv0000104Dsd0000909Cbc03sc00i00
vendor : NVIDIA Corporation
driver : nvidia-304 - distro non-free
driver : xserver-xorg-video-nouveau - distro free builtin
driver : nvidia-375 - distro non-free recommended
driver : nvidia-340 - distro non-free

4. See that nvidia-375 is recommended , we install it

$ sudo apt-get install nvidia-375

5. After finish, type this to go to Nvidia setting:

$ nvidia-settings

At the tab PRIME Profiles, choose Nvidia and restart the computer, or just login to register the changes.

6. Check the usage of your GPU with this command (or go to nvidia setting to see it)

$ nvidia-settings -q GPUUtilization -q useddedicatedgpumemory

7. To quickly change between Intel and Nvidia profiles, install prime-indicator to have an icon in the task bar

$ sudo add-apt-repository ppa:nilarimogard/webupd8
$ sudo apt-get update
$ sudo apt-get install prime-indicator

This allows changing profile on-fly, however it requires a log-out to make the change.

At the moment, these is what I did, I’ve tried it and the rendering was faster than before, you may try out with the command glxgears to check the FPS:

$ glxgears

The results were 60 FPS for Intel card, and 8000 FPS for Nvidia card.