Showing posts with label unix. Show all posts
Showing posts with label unix. Show all posts

Tuesday, December 10, 2019

Install brat on Ubuntu (Apache2)

Install brat

Install Apache2
Download and unzip the brat v1.3
Move the folder to /var/www/brat
In /var/www/brat run ‘./install’. Follow the instruction to set username, password and email.
In etc/apache2/sites-avialble/000-default.conf add









Alias /brat "/var/www/brat"
<Directory "/var/www/brat">
    Options +ExecCGI
    AddHandler cgi-script .cgi
    # AddHandler fastcgi-script fcgi
    AllowOverride Options Indexes FileInfo Limit
    AddType application/xhtml+xml .xhtml
    AddType font/ttf .ttf
</Directory>
Restart apache2:


sudo service apache2 reload

Enable FastCGI

Install fastcgi by running ‘sudo apt-get install libapache2-mod-fastcgi’
Change etc/apache2/sites-avialble/000-default.conf


 
# AddHandler cgi-script .cgi
AddHandler fastcgi-script fcgi

Build FreeRDP with smartcard on Ubuntu

Compilation instruction
Besides the suggested base dependencies, also install libpcsclite-dev



sudo apt install libpcsclite-dev
cmake -DWITH_PCSC=ON -DWITH_SSE2=ON .

Then follow the Build section in the compilation instruction.

How to use xRDP for remote access to Ubuntu

 
By | February 14, 201
 

Since the current desktop manager of Ubuntu does not work with xRDP, an alternative desktop manager needs to be installed. In this post, we will use XFCE.

Install xRDP and XFCE


sudo apt-get install xrdp xfce4 xfce4-terminal gnome-icon-theme-full tango-icon-theme

Configure xRDP

First, create an .xsession file in the home directory.

echo xfce4-session >~/.xsession
Then edit the startup file for xRDP /etc/xrdp/startwm.sh.








#!/bin/sh
 
if [ -r /etc/default/locale ]; then
  . /etc/default/locale
  export LANG LANGUAGE
fi
 
startxfce4

Restart xRDP


sudo service xrdp restart

Test xRDP

As an example, on Windows, start the Remote Desktop client (mstsc.exe) and enter the IP address of Ubuntu. Then you will see the login screen. After entering the Ubuntu username and password and click “OK”, a window will show the login process. Finally, you’ll have access to your Ubuntu machine.

Saturday, December 7, 2019

How to delete all .svn in a folder

By | September 20, 2013


If you need to remove all .svn folders in a project, run


find . -name ".svn" -exec rm -rf {} ;
 
or more precisely, run


find . -type d -name '.svn' -print -exec rm -rf {} ;
 
The script starts from the current directory and searches recursively to the sub-folders. This script also works on other names by replacing “.svn”. But if the name is too general especially if you use the regular expression, you may end up by deleting a bunch of folders/files you don’t want to. A safer way is to run find first to verify all found folders/files are really what you intend to remove.

How to convert video using MEncoder


By | September 26, 2013 
 
 MEncoder is a free command line video decoding, encoding, and filtering tool. As a by-product of MPlayer, it can convert all formats that Mplayer can understand.
  1. install mencoder
    sudo apt-get install mencode
    
  2. avi → mp4
    mencoder 1.avi -o 1.mp4 -oac copy -ovc lavc -lavcopts vcodec=mpeg1video -of mpeg
    
    • o: output file name.
    • oac: audio codecs for encoding. copy does not reencode but just copy compressed frames.
    • ovc: video codecs for encoding. lavc means using one of libavcodec’s video codecs.
    • lavcopts: libavcodec’s video codecs. Here we choose MPEG-1 video.
    • of: output container formats. mpeg means MPEG-1 and MPEG-2 PS.
  3. mov → avi
    mencoder -oac mp3lame -ovc x264 1.mov -o 1.avi
    
    • oac: mp3lame means encoding to VBR, ABR or CBR MP3 with LAME.
    • ovc: x264 means using x264, MPEG-4 Advanced Video Coding (AVC), AKA H.264 codec.

Install Source Code Pro on Ubuntu

By | September 28, 2013


Source code pro is a free set of monospace fonts created by Adobe. It is very suitable for text editors and terminal windows. The fonts are also available on various Google Web Fonts.
  1. download: https://sourceforge.net/projects/sourcecodepro.adobe/files/
  2. unzip file
  3. mkdir -p ~/.fonts
  4. move OpenType fonts (.otf) or TrueType files (.ttf) to ~/.fonts
  5. sudo fc-cache

How To Run Android 4.0 In Virtualbox (Linux)

By | October 9, 2013


Sometimes I need to test my app or try some new apps on main Android devices available on the market. Of course I don’t want to install them on my working cellphone. Under such circumstances, I prefer installing a virtual machine on my PC and testing whatever on it. Here in this post, I provide a way to run Android in Virtualbox.
  1. Choose an Android 4.0.3_r1 (20120518 build)
  2. Install (import) the package into VirtualBox
  3. Install Android SDK
    • Download Android SDK
    • Extract the file to “$ANDROID”, and go to $ANDROID/tools
    • run ./android and install Android SDK Platform-tools
  4. Set up NAT
    • Open VirtualBox
    • Go to buildroid VM’s Settings → Network
    • Under Adapter 1 tab, choose Attached to: NAT.
    • Expand Advanced and click Port Forwarding button.
    • Click Insert new rule button, input 5555 into Host Port and Guest Port.
    • Click OK to return to VirtualBox.
  5. Install Google play
    • Download Google apps
    • go to $ANDROID/platform-tools, and run







adb connect localhost
adb push $PATH/buildroid-gapps-ics-20120317-signed.tgz /sdcard/
adb shell
su
mount -o remount,rw /system
tar -xvzf /sdcard/buildroid-gapps-ics-20120317-signed.tgz
mount -o remount,ro /system
reboot

Share folders via Samba without a password

By | September 8, 2013


Switching from Windows to Linux, the first thing might be to share folders on Linux with Windows. That will enable transferring files easily. In Linux, such operation is not always trivial. On Ubuntu, We need to install the samba to share files/folders. Here are the instructions:
  1. install the samba package:
    sudo apt-get install samba
  2. edit the configure file /etc/samba/smb.conf.
  3. change information: security = share.
  4. add new section:
    [share] 
    comment = Ubuntu File Server Share 
    path = /srv/samba/share 
    browsable = yes 
    guest ok = yes 
    guest only = yes
    read only = no
    writable = True 
    create mask = 0755
    
  5. create directory and change the permission:
    sudo mkdir -p /srv/samba/share 
    sudo chown nobody.nogroup /srv/samba/share/
    
  6. restart the samba services to enable the new configuration:
    sudo restart smbd 
    sudo restart nmbd
    

Thursday, December 5, 2019

Install Qt5.7 binary on Ubuntu 16.04

Run
1
2
3
sudo add-apt-repository -y ppa:beineri/opt-qt57-xenial
sudo apt update
sudo apt install qt-latest