Apr 14, 2014
TechnologyFirst install wordpress manually:
cd /srv/http
wget https://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
chown -R http wordpress
chgrp -R http wordpress
Now add a configuration file on wordpress:
[Trusty@/etc/httpd/conf/extra]$ pwd
/etc/httpd/conf/extra
[Trusty@/etc/httpd/conf/extra]$ cat httpd-wordpress.conf
Alias / "/srv/http/wordpress/"
<Directory "/srv/http/wordpress/">
AllowOverride All
Options FollowSymlinks
Order allow,deny
Allow from all
php_admin_value open_basedir "/srv/:/tmp/:/srv/http/wordpress/:/usr/share/webapps/:/etc/webapps:$"
</Directory>
In /etc/httpd/conf/httpd.conf file, add:
# Include wordpress configuration
Include conf/extra/httpd-wordpress.conf
Create the Wordpress Database and User
mysql -u root -p
CREATE DATABASE wordpress;
CREATE USER wordpressuser@localhost;
SET PASSWORD FOR wordpressuser@localhost= PASSWORD("password");
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
exit
Configure the configuration file:
cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php
sudo nano ~/wordpress/wp-config.php
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');
/** MySQL database username */
define('DB_USER', 'wordpressuser');
/** MySQL database password */
define('DB_PASSWORD', 'password');
Configure the php.ini:
sudo nano /etc/php/php.ini
extension=mysql.so
sudo systemctl restart httpd
Then visit the url of http://localhost/, install the wordpress and begin to customize.
Apr 14, 2014
Technology###Installation
In ArchLinux, install zsh via:
pacman -S zsh zsh-doc
Duplicate the .bashrc to .zshrc
cp ~/.bashrc ~/.zshrc
But notice, when using zsh, we should use following command under zshh:
rake new_post["Switch To ZSH"]
to
rake new_post\["Switch To ZSH"\]
Or, we can use noglob in zsh specified file .zshrc
alias rake='noglob rake'
###Setting
More settings on .zshrc:
# Use prompt -l you will see all of the prompt.
autoload -U promptinit
promptinit
alias rake='noglob rake'
# Customized PS1, with color.
export PS1="[%n@%~]$ "
###Terminal Title
Terminal Title Setting, add following lines into ~/.zshrc:
case $TERM in
(*xterm* | rxvt)
# Write some info to terminal title.
# This is seen when the shell prompts for input.
function precmd {
print -Pn "\e]0;zsh%L %(1j,%j job%(2j|s|); ,)%~\a"
}
# Write command and args to terminal title.
# This is seen while the shell waits for a command to complete.
function preexec {
printf "\033]0;%s\a" "$1"
}
;;
esac
###Enable History
Add the definition of history
# History File Definition
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
# Share history between terminal
setopt inc_append_history
setopt share_history
###Chinese Encoding
Add following definition to the .zshrc:
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
And in the terminal simulator, select the encoding:
Edit->Preference: Advanced->Encoding->Default Encoding(UTF-8)
Apr 9, 2014
TechnologyPosition
From FullCircle issue 24, to issue 55
C&C 11
This chapter tells you how to automatical your tasks using crontab.
Useful commands
find /var/logs/ -name "*.log" | while read line; do cat "${line}"; done
sudo crontab -e root
crontab format:
Example:
*/5 * * * * command Every 5 minutes
00 18 * * sun command Every Sunday at 6
C&C 12
This Chapter tells you how to use different shell, and its history, functions.
C&C 13
This chapter tell you how to listen music using MOC(Music On Console), and use IRC under terminal(irssi), later I will install them and try.
C&C 14
This chapter introduce how to change you prompt,(export PS1), some useful tools, for example:
“watch vmstat” will display the vmstat every 2 seconds.
Tiling window manager, awesome, DWM, Xmodnad, ratpoison, ion, etc.
Live-Office?
C&C 15
This chapter take ping for example and show you how to use man and help.
C&C 16
This chapter shows how to detect and bind keys.
xev for X, showkey for terminal, for detecting keys.
.Xmodmap for key definition, keycode 153 = XF86MonBrightnessDown
/usr/include/X11/keysymdef.h contains all of the list of the symbols, extra function keys in /usr/include/X11/XKeySymDB
Further Reading: http://people.freedesktop.org/~hughsient/quirk/quirk-keymap-index.html
C&C 17
This chapter shows disk usage skills.
C&C 18
This chapter introduce harddisk and S.M.A.R.T
C&C 19
This chapter introduct screen, remember use ctlr+a /d for detaching the session.
C&C 20
This chapter continue introducing screen, for sharing session:
ctrl + a :multiuser on ctrl+a :acladd
Other user connect via screen -x $USER/<screenID/name>
Other different commands.
C&C 21
Introducing Tmux for remote usage.Also byobu is introduced.
C&C 22
Switch to ZSH, need to re-read after back.
C&C 23
Colorscheme, need to re-read after back.
C&C 24
Talks on how to set ssh proxy.
C&C 25
gstm of GUI program which did ssh port forwarding.
diff usage
C&C 26
wget and curl, use it according to your own habit.
C&C 27
Network Configuration.
C&C 28
fdisk, find, etc.
C&C 29
Classic Command List.
C&C 30
Language for System.
C&C 31
conky skills, let conky display how many updates available.
C&C 32
Conky skills, his conky could display the listening music and album picture.But how about the pandora?
C&C 33
Conky skills, to-do and the zenity for creating the diaglog.
C&C 34
zenity configuration, MPD daemon.
C&C 35
Asia Language support, in fact we are much more professionaler than the author :)
C&C 36
Use of graphicmagic, which derived from imagik from 2002, try it later.
C&C 37
Latex Introduction.
C&C 38
Issue 51, damaged.
C&C 40
Latex continued.
C&C 41
/etc/motd(Message Of The Day)
C&C 42
vim/gvim, notice some command, and author’s vimrc file.
C&C 43
Advance usage of vi/vim , TBD
Apr 8, 2014
Technology###Position:
From FullCircle 13, Ended at FullCircle 23.
###C&C 1
Try to run following command:
man man
man -k PDF
man apropos
apropos PDF
man --help
Fastly get help from manual, for example, following command will let you dive into regex:
man -k regex
re_comp (3) - BSD regex functions
re_exec (3) - BSD regex functions
regcomp (3) - POSIX regex functions
regerror (3) - POSIX regex functions
regex (3) - POSIX regex functions
regex (7) - POSIX.2 regular expressions
regexec (3) - POSIX regex functions
regfree (3) - POSIX regex functions
###C&C 2
This part describe how to come and go into the directory.
###C&C 3
This part describe how to copy and move the file.
###C&C 4
This part introduce the nano and vim. Remember one: :e in vim means edit another file.
###C&C 5
This part introduce aptitude, Notice the comment of the aptitude search result:
- p, No trace of the package exists on the system.
- c, The package is deleted, but its configuration file is still on the system.
- i, The package is installed.
- v, The package is virtual.
And one command: sudo aptitude safe-upgrade.
###C&C 6
This part shows how to find something in your system. - grep, “grep -n”(print line number), “grep -ir”(recursively and ignore case).
- *, difference of “echo ” and “echo ‘'".
- xargs,
find recipes -type f -name '*-cake.txt' | xargs -I % cp % old-recipes/
find recipes -type f -name '*-cake.txt'
recipes/a-cake.txt
recipes/b-cake.txt
recipes/c-cake.txt
cp recipes/a-cake.txt old-recipes/
cp recipes/b-cake.txt old-recipes/
cp recipes/c-cake.txt old-recipes/
- updatedb and locate.
###C&C 7
The author talks lots on why you should not fear terminal.
###C&C 8 - cut way:
Trusty@HN:~/code/purec/FC/C8$ cat /etc/issue
Ubuntu 13.04 \n \l
Trusty@HN:~/code/purec/FC/C8$ cat /etc/issue|head -n 1
Ubuntu 13.04 \n \l
Trusty@HN:~/code/purec/FC/C8$ cat /etc/issue|head -n 1|cut --delimiter=" " -f 1,2
Ubuntu 13.04
- sed way:
Trusty@HN:~/code/purec/FC/C8$ cat /etc/issue | sed '{s/\\n//}'
Ubuntu 13.04 \l
Trusty@HN:~/code/purec/FC/C8$ cat /etc/issue | sed '{s/\\n//; s/\\l//;}'
Ubuntu 13.04
Trusty@HN:~/code/purec/FC/C8$ cat /etc/issue | sed '{s/\\n//; s/\\l//;/^$/d}'
Ubuntu 13.04
- awk way:
Trusty@HN:~/code/purec/FC/C8$ cat /etc/issue | awk '/\\n/ {print $1,$2}'
Ubuntu 13.04
First find any line which have ‘\n’ in it, then print this line’s $1 and $2.
4. Further reading
http://fullcirclemagazine.org/issue-21-shell-script/
Sed -http://www.grymoire.com/Unix/Sed.html
awk -http://www.linuxjournal.com/article/8913 or http://www.linuxfocus.org/English/September1999/article103.html
cut -http://learnlinux.tsf.org.za/courses/build/shell-scripting/ch03s04.html
###C&C 9
This part introduced the ffmpeg and imagick.
Since the internet is not OK, I cannot install the package, try them later.
###C&C 10
This part is very useful, it shows some system administration tools.
- bootchart, install via “sudo apt-get install bootchart”, then in /var/log/bootchart/ you will see the correct image.
- sudo lshw will list all of the hw info, sudo lshw -C Network will list all of the infos on networking.
- Further reading: http://www.troubleshooters.com/tpromag/200007/200007.htm
Apr 8, 2014
Technology###Full Circle C 8
####Limitation
Fibonacci sequence: normally this program limited by the limitation of unsigned long long
#include <stdio.h>
typedef unsigned long long fibo_type;
#define FIBO_FORMAT "%10llu"
void printFibo(fibo_type num)
{
printf(FIBO_FORMAT, num);
}
int main()
{
int num = 0;
fibo_type a = 0, b=1, c;
printf("%4d: ", ++num);
printFibo(a);
printf("\n");
printf("%4d: ",++num);
printFibo(b);
printf("\n");
c=a+b;
while(c>=b)
{
printf("%4d: ",++num);
printFibo(c);
printf("\n");
a=b;
b=c;
c=a+b;
}
printf("Stopped after %d digits\n", num);
printFibo(c);
printf("\n");
return 0;
}
This program will exit when c reach the limitation of definition of unsigned long long
####Using GMP
Using gmp to re-write this program:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gmp.h>
int main()
{
int num = 0;
mpz_t f_1;
mpz_t f_2;
mpz_init(f_1);
mpz_init(f_2);
mpz_set_ui(f_1, 0);
mpz_set_ui(f_1, 1);
printf("%10d: 0\n", ++num);
while(1)
{
mpz_add(f_1, f_2, f_1);
mpz_swap(f_1, f_2);
char *res = mpz_get_str(NULL, 10, f_2);
printf("%10d: %s\n", ++num, res);
free(res);
sleep(1);
}
mpz_clear(f_1);
mpz_clear(f_2);
return 0;
}
Compile it via:
gcc -o Fibonacci2 Fibonacci2.c -lgmp
This won’t have limitation currently, but you have to finish the execises, when you get internet connection.