List of common decompress & compress tools in unix

For my future reference:  (整理自互联网)

check folder size:

du -sh *

————

1. 7-zip:  (.7z file)

官网下载地址:http://www.7-zip.org/download.html
源文件项目地址:http://sourceforge.net/projects/p7zip/,目前最新版为9.20.1。
执行以下命令下载安装:

wget http://nchc.dl.sourceforge.net/project/p7zip/p7zip/9.20.1/p7zip_9.20.1_src_all.tar.bz2
tar -jxvf p7zip_9.20.1_src_all.tar.bz2
cd p7zip_9.20.1
make
make install

使用7zip的命令是7za。
安装完成后的使用方法:
7za {a|d|l|e|u|x} 压缩包文件名 {文件列表或目录,可选}

a 向压缩包里添加文件或创建压缩包,如向001.7z添加001.jpg,执行:7za a 001.7z 001.jpg;将001目录打包执行:7za a 001.7z 001;
d 从压缩里删除文件,如将001.7z里的001.jpg删除,执行:7za d 001.7z 001.jpg
l 列出压缩包里的文件,如列出001.7z里的文件,执行:7za l 001.7z
e 解压到当前目录,目录结构会被破坏,如001.rar内有如下目录及文件123/456/789.html,
执行:7za e 001.rar,目录123和456及文件789.html都会存放在当前目录下。
x 以完整路径解压。

zip文件解压中文文件乱码问题,由于zip文件中没有声明其编码,所以在Linux上使用unzip解压以默认编码解压,中文文件名会出现乱码。

————–

2. tar:  (decompress)

  1. Type at the command prompt
    tar xvzf file-1.0.tar.gz – to uncompress a gzip tar file (.tgz or .tar.gz)
    tar xvjf file-1.0.tar.bz2 – to uncompress a bzip2 tar file (.tbz or .tar.bz2)
    tar xvf file-1.0.tar – to uncompressed tar file (.tar)
    • x = eXtract, this indicated an extraction c = create to create )
    • v = verbose (optional) the files with relative locations will be displayed.
    • z = gzip-ped; j = bzip2-zipped
    • f = from/to file … (what is next after the f is the archive file)
  2. The files will be extracted in the current folder (most of the times in a folder with the name ‘file-1.0’).

Continue reading List of common decompress & compress tools in unix

Advertisements

Using Stanford Phoenix++ MapReduce to count the most frequent words in Wikipedia Database

Log of a quick and fun afternoon project.

1. Download Wikipedia English-language Database:

http://en.wikipedia.org/wiki/Wikipedia:Database_download

Download pages-articles.xml.bz2

Uncompress it ro pages-articles.xml (around 45GB)

2. Download Phoenix++:

http://mapreduce.stanford.edu/

http://mapreduce.stanford.edu/plus/phoenix++-1.0.tar.gz

make binary file and then find ‘word_count’ in ‘tests’ folder

3. copy wordcount and pages-articles.xml to the same folder

./word_count pages-articles.xml 1000 >wikiwords.txt

Using wordcount program to count top 1000 popular words from wiki database

4. Result: (Using 8 Xeon E5 server, 128 processing cores) Continue reading Using Stanford Phoenix++ MapReduce to count the most frequent words in Wikipedia Database

Windows 8.1 Event 10016 Fix: The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID {D63B10C5-BB46-4990-A94F-E40B9D520160}

A year ago, I had such error message in the event viewer on the first day of fresh installation of Windows 8. I believed it was also the reason that I had a blue screen: MEMORY_MANAGEMENT error. It was caused by ntoskrnl.exe upon inspecting Windows Mini Dump, by a tool named BlueScreenView.  Now a year later, after I recently updated to Windows 8.1 Update 1, the problem came back again. I decide to log it here.

After inspecting Windows Event Viewer, the error is the same as before, which is:

Event 10016, DistributedCOM

The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID
{D63B10C5-BB46-4990-A94F-E40B9D520160}
and APPID
{9CA88EE3-ACB7-47C8-AFC4-AB702511C276}
to the user NT AUTHORITYSYSTEM SID (S-1-5-18) from address LocalHost (Using LRPC) running in the application container Unavailable SID (Unavailable). This security permission can be modified using the Component Services administrative tool.

Here is a way I found to fix it:

1.Go to Component Service: dcomcnfg  (in Windows 8.1, you may hit ‘Win’ + Q and enter dcomcnfg, and launch it by Admin)

At the left panel, go to ‘Component Service->Computers->My Computer->DCOM Config’, then at the right panel, find by name: ‘RunTimeBroker’ (This is {D63B10C5-BB46-4990-A94F-E40B9D520160})

Right click it, choose ‘Property’ -> ‘Security’.   Then I found everything was grey and unable to edit.

2. To enable editing ‘Security’, launch regedit (‘Win’ + Q and enter regedit, open the application by Admin)

Browse to Hkey_classes_rootAppID{9CA88EE3-ACB7-47C8-AFC4-AB702511C276}, Right click it

Choose ‘Permissions’, -> Choose ‘Advanced‘ -> Change Owner to ‘Administrators’ of your PC -> Apply the change

Then change ‘SYSTEM’ and ‘Administrators’ ‘s permission to ‘Full Control’ under ‘Permission’ -> Apply the change

3. Go back to Component Service dcomcnfg

Now the Security section is able to edit.

In ‘Launch and Activation Permissions’, Add ‘SYSTEM’ and give it permission ‘Full Control’

4. DONE!

Continue reading Windows 8.1 Event 10016 Fix: The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID {D63B10C5-BB46-4990-A94F-E40B9D520160}

Putty Color Scheme Tango & My Putty Settings

I use Putty w/ Xming Server to replace  X-win 32 and VNC.

Color Scheme

After searching, I found a decent color scheme for Putty.

To make it default for Putty, paste the following code and name the file PuttyConfig.PS1  (Windows Power Shell Script):  (I borrow the script from another site, see links at the end)

param([string]$puttyConf)

$sessionKey = "HKCU:SoftwareSimonTathamPuTTYSessions$puttyConf"
if ( test-path $sessionKey ) {
   $values = @{
      "Xterm256Colour" = 0x00000001
      "BoldAsColour" = 0x00000001
      "Colour0" = "187,187,187"
      "Colour1" = "255,255,255"
      "Colour2" = "8,8,8"
      "Colour3" = "85,85,85"
      "Colour4" = "0,0,0"
      "Colour5" = "0,255,0"
      "Colour6" = "46,52,54"
      "Colour7" = "85,87,83"
      "Colour8" = "204,0,0"
      "Colour9" = "239,41,41"
      "Colour10" = "78,154,6"
      "Colour11" = "138,226,52"
      "Colour12" = "196,160,0"
      "Colour13" = "252,233,79"
      "Colour14" = "52,101,164"
      "Colour15" = "114,159,207"
      "Colour16" = "117,80,123"
      "Colour17" = "173,127,168"
      "Colour18" = "6,152,154"
      "Colour19" = "52,226,226"
      "Colour20" = "211,215,207"
      "Colour21" = "238,238,236"
   }
   $values.Keys | %{
      set-itemproperty $sessionKey $_ $values[$_]
   }
} else {
   write-error "Profile '$puttyConf' does not exist in the Putty configuration"
}

Fonts & Window

Double click the file to run it.  I also set Font to “Courier New”, 12-point, Font quality: ClearType

I wish to have a transparent putty terminal window, so I use a modified version of Putty: PuttyTray.  Then set window opacity( in Colours section ) to 220.

Export Putty Session Settings

To export putty settings with session list: (This will generate a .reg file on the Desktop)

regedit /e "%userprofile%desktopputty.reg" HKEY_CURRENT_USERSoftwareSimonTatham

To export sessions only:

regedit /e "%userprofile%desktopputty-sessions.reg" HKEY_CURRENT_USERSoftwareSimonTathamPuTTYSessions

Continue reading Putty Color Scheme Tango & My Putty Settings

Connect iPhone/Laptop to Home Network via OpenVPN on Cisco E3000 w/ Tomato USB firmware

This is a log to try OpenVPN.

——————

Environment:

Router: Cisco E3000 w/ Tomato 1.28-116 K26 by Shibby

Phone: iOS 7

Computer: Windows 8.1 x64

——————-

1. Download OpenVPN at: http://openvpn.net/index.php/open-source/downloads.html

choose Windows Installer (64bit), then install with all the components.

2. Creating the Certificates and keys

Run Windows Command Prompt (cmd) as Administrator:

cd C:Program FilesOpenVPNeasy-rsa

init-config

This will copy vars.bat and openssl.cnf to easy-rsa folder

notepad vars.bat

Open notepad and edit vars.bat, fill the following at the end of file:

set KEY_COUNTRY=
set KEY_PROVINCE=
set KEY_CITY=
set KEY_ORG=
set KEY_EMAIL=

Save. Then type the following: (when at the 3rd command => build-ca, hit ‘Enter’ for everything except ‘Common Name Parameter’, enter something, eg:  MyName) Continue reading Connect iPhone/Laptop to Home Network via OpenVPN on Cisco E3000 w/ Tomato USB firmware

Code::Blocks installation in CentOS 6.5 x64_minimal

A log of installing Code::Blocks in CentOS 6.5 x64 Minimal edition. (It’s a server, and codeblocks will be accessed on clients via putty and Xming.)

#Install some necessary libraries
yum groupinstall "Development Tools"  

#install rpmforge, there are other ways, here I use wget to download rpm package and install
#install wget
yum install wget
mkdir ~/temp
cd ~/temp
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
yum install --enablerepo=rpmforge-extras

#Install wxGTK
yum install wxGTK-devel

#Install codeblocks from source
#ref:http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_RPM_based_distributions
cd ~
mkdir codeblocks
cd codeblocks
svn checkout svn://svn.berlios.de/codeblocks/trunk
cd trunk
./bootstrap
./configure
make
sudo make install

#Now Code::Blocks has installed, configure remote access
#enable X11 forwarding: ref:http://www.techotopia.com/index.php/Displaying_CentOS_Applications_Remotely_(X11_Forwarding)
sudo vi /etc/ssh/ssh_config
#Edit the file and make sure -> X11Forward yes
sudo yum xorg-x11-xauth.x86_64
sudo yum install xorg-x11-fonts

#Now on a Windows client, using Putty and Xming access the server
#On windows desktop, download and install Xming Server and Xming fonts
#in Putty, enable X11 Forwarding, set display to "Localhost:0"

#Type the following:
echo $DISPLAY
#It should return localhost:10.0

#Run Code::Blocks
codeblocks &

 

Charter IPv6 using 6rd with Cisco E3000 and Tomato 1.28-116 K26 by Shibby

My Local ISP – Charter is now offering IPv6 through 6rd relay.

Reference page: http://www.myaccount.charter.com/customers/Support.aspx?SupportArticleID=2665#ipv6prep

6RD Configuration Settings
As part of Charter's IPv6 Trials we have made available a Public 6rd Border Relay. 
If you are interested in participating in our early trials and own a device 
that supports 6RD use this configuration information to begin experiencing the Next Generation Internet:

6rd Prefix = 2602:100::/32
Border Relay Address = 68.114.165.1
6rd prefix length = 32
IPv4 mask length = 0
Primary DNS Address = 2607:f428:1::5353:1

Secondary DNS Address = 2607:f428:2::5353:1

I am using Cisco E3000 w/ Tomato 1.28-116 K26 by Shibby

After hours of researching, finally I can access ipv6 websites.

Steps:

1. In “Administration” -> “Scripts”->”Init”, add:

insmod tunnel4
insmod sit

2. In “Administration” -> “Scripts”->”WAN Up”, add:

WANIP=$(nvram get wan_ipaddr)
if [ -n "$WANIP" ]; then
    ip tunnel del tun6rd
    V6PREFIX=$(printf '2602:100:%02x%02x:%02x%02x' $(echo $WANIP | tr . ' '))
    ip tunnel add tun6rd mode sit local $WANIP ttl 64
    ip addr add ${V6PREFIX}::1/32 dev tun6rd
    ip addr add ${V6PREFIX}::1/64 dev br0
    ip link set tun6rd up
    ip -6 route add ::/0 via ::68.114.165.1 dev tun6rd
    service radvd restart
fi

route -A inet6 del default gw :: metric 1024 `nvram get wan_iface`

*Initially I didn’t have the last line, I couldn’t get ipv6 address. After searching on forums (I forgot the address), I added the last line, suddenly it works perfectly!

3. In “Basic”->”IPv6″-> Choose “Other”

in WAN interface, put: tun6rd

Leave Router IPv6 Address blank

In Static DNS, put Charter’s IPv6 DNS address

Save

4. All done

5.Test your network @ http://test-ipv6.com/

6. Try https://ipv6.google.com/

Reference:

http://kdwink.blogspot.com/2013/05/ipv6-with-charter-communications.html

http://tomatousb.org/forum/t-473266/howto-ipv6-using-6rd