jekyll环境搭建

大家都知道github pages是用了jekyll,我们自己如何搭建一个网站呢?

#安装依赖环境
apt-get install ruby ruby-dev

#安装jekyll
gem install bundler jekyll

#新建网站
jekyll new mysite

#开启网站
cd mysite
bundle exec jekyll serve --host 0.0.0.0

#浏览网站
http://172.16.172.80:4000

语法插件从WP-Syntax替换为SyntaxHighlighter Evolved

今天正好有些时间,索性将语法插件从WP-Syntax替换为SyntaxHighlighter Evolved。

由于是通过后台SQL进行处理的,出现了不少问题,经过3小时奋战,还是调整的差不多了。

现在有两个问题:
1、太长的代码要么不换行,要么换行不好看
2、有些语法不支持,如per,Io,go等
3、应该还有一些SQL操作的遗留问题,后面发现再调整吧

	'as3'           => 'as3',
	'actionscript3' => 'as3',
	'bash'          => 'bash',
	'shell'         => 'bash',
	'coldfusion'    => 'coldfusion',
	'cf'            => 'coldfusion',
	'clojure'       => 'clojure',
	'clj'           => 'clojure',
	'cpp'           => 'cpp',
	'c'             => 'cpp',
	'c-sharp'       => 'csharp',
	'csharp'        => 'csharp',
	'css'           => 'css',
	'delphi'        => 'delphi',
	'pas'           => 'delphi',
	'pascal'        => 'delphi',
	'diff'          => 'diff',
	'patch'         => 'diff',
	'erl'           => 'erlang',
	'erlang'        => 'erlang',
	'fsharp'        => 'fsharp',
	'groovy'        => 'groovy',
	'java'          => 'java',
	'jfx'           => 'javafx',
	'javafx'        => 'javafx',
	'js'            => 'jscript',
	'jscript'       => 'jscript',
	'javascript'    => 'jscript',
	'latex'         => 'latex', // Not used as a shortcode
	'tex'           => 'latex',
	'matlab'        => 'matlabkey',
	'objc'          => 'objc',
	'obj-c'         => 'objc',
	'perl'          => 'perl',
	'pl'            => 'perl',
	'php'           => 'php',
	'plain'         => 'plain',
	'text'          => 'plain',
	'ps'            => 'powershell',
	'powershell'    => 'powershell',
	'py'            => 'python',
	'python'        => 'python',
	'r'             => 'r', // Not used as a shortcode
	'splus'         => 'r',
	'rails'         => 'ruby',
	'rb'            => 'ruby',
	'ror'           => 'ruby',
	'ruby'          => 'ruby',
	'scala'         => 'scala',
	'sql'           => 'sql',
	'vb'            => 'vb',
	'vbnet'         => 'vb',
	'xml'           => 'xml',
	'xhtml'         => 'xml',
	'xslt'          => 'xml',
	'html'          => 'xml',

修改WordPress域名

比如,我需要把域名dm01.neohope.org换为dm02.neohope.org,需要进行以下操作:

1、如果需要,可以重命名wordpress文件夹

2、如果需要,修改wordpress的数据库设置

3、更新wordpress主配置

UPDATE wp_options SET option_value = replace( option_value, 'dm01.neohope.org', 'dm02.neohope.org' ) WHERE option_name = 'home' OR option_name = 'siteurl';  

4、更新posts

UPDATE wp_posts SET post_content = replace( post_content, 'dm01.neohope.org', 'dm02.neohope.org' ) ;  
UPDATE wp_posts SET guid = replace( guid, 'dm01.neohope.org', 'dm02.neohope.org' ) ;  

5、更新comments

UPDATE wp_comments SET comment_content = replace(comment_content, 'dm01.neohope.org', 'dm02.neohope.org') ;
UPDATE wp_comments SET comment_author_url = replace(comment_author_url, 'dm01.neohope.org', 'dm02.neohope.org')

6、搞定

修改WordPress数据库前缀

一般来说,为了数据安全,大家都很修改一下WordPress数据的前缀,而不是使用默认的wp_。
修改WordPress数据库前缀步骤如下:

1、备份数据库
2、打开wp-config.php文件,修改table_prefix变量

$table_prefix  = 'wp_a123456_';

3、使用phpMyAdmin修改数据库中的表名

RENAME table `wp_commentmeta` TO `wp_a123456_commentmeta`;
RENAME table `wp_comments` TO `wp_a123456_comments`;
RENAME table `wp_links` TO `wp_a123456_links`;
RENAME table `wp_options` TO `wp_a123456_options`;
RENAME table `wp_postmeta` TO `wp_a123456_postmeta`;
RENAME table `wp_posts` TO `wp_a123456_posts`;
RENAME table `wp_terms` TO `wp_a123456_terms`;
RENAME table `wp_term_relationships` TO `wp_a123456_term_relationships`;
RENAME table `wp_term_taxonomy` TO `wp_a123456_term_taxonomy`;
RENAME table `wp_usermeta` TO `wp_a123456_usermeta`;
RENAME table `wp_users` TO `wp_a123456_users`;

4、修改Options表

SELECT * FROM `wp_a123456_options` WHERE `option_name` LIKE '%wp_%'

将前缀全部修改掉。

5、修改UserMeta表

SELECT * FROM `wp_a123456_usermeta` WHERE `meta_key` LIKE '%wp_%'

将前缀全部修改掉。

6、现在应该正常工作了,记得再次备份哦。

7、数据库很小的话,可以全部导出,用vim修改后,再全部导入,会简单一些哦。

参考:
How to Change the WordPress Database Prefix to Improve Security

语法插件WP-Syntax

WP-SYNTAX插件很不错,但经常找语言代码就不好了,
下面是它的语言表,希望对大家有用:)

$lookup = array(
    '6502acme' => array( 'a', 's', 'asm', 'inc' ),
    '6502tasm' => array( 'a', 's', 'asm', 'inc' ),
    '6502kickass' => array( 'a', 's', 'asm', 'inc' ),
    '68000devpac' => array( 'a', 's', 'asm', 'inc' ),
    'abap' => array('abap'),
    'actionscript' => array('as'),
    'ada' => array('a', 'ada', 'adb', 'ads'),
    'apache' => array('conf'),
    'asm' => array('ash', 'asm', 'inc'),
    'asp' => array('asp'),
    'bash' => array('sh'),
    'bf' => array('bf'),
    'c' => array('c', 'h'),
    'c_mac' => array('c', 'h'),
    'caddcl' => array(),
    'cadlisp' => array(),
    'cdfg' => array('cdfg'),
    'cobol' => array('cbl'),
    'cpp' => array('cpp', 'hpp', 'C', 'H', 'CPP', 'HPP'),
    'csharp' => array('cs'),
    'css' => array('css'),
    'd' => array('d'),
    'delphi' => array('dpk', 'dpr', 'pp', 'pas'),
    'diff' => array('diff', 'patch'),
    'dos' => array('bat', 'cmd'),
    'gdb' => array('kcrash', 'crash', 'bt'),
    'gettext' => array('po', 'pot'),
    'gml' => array('gml'),
    'gnuplot' => array('plt'),
    'groovy' => array('groovy'),
    'haskell' => array('hs'),
    'html4strict' => array('html', 'htm'),
    'ini' => array('ini', 'desktop'),
    'java' => array('java'),
    'javascript' => array('js'),
    'klonec' => array('kl1'),
    'klonecpp' => array('klx'),
    'latex' => array('tex'),
    'lisp' => array('lisp'),
    'lua' => array('lua'),
    'matlab' => array('m'),
    'mpasm' => array(),
    'mysql' => array('sql'),
    'nsis' => array(),
    'objc' => array(),
    'oobas' => array(),
    'oracle8' => array(),
    'oracle10' => array(),
    'pascal' => array('pas'),
    'perl' => array('pl', 'pm'),
    'php' => array('php', 'php5', 'phtml', 'phps'),
    'povray' => array('pov'),
    'providex' => array('pvc', 'pvx'),
    'prolog' => array('pl'),
    'python' => array('py'),
    'qbasic' => array('bi'),
    'reg' => array('reg'),
    'ruby' => array('rb'),
    'sas' => array('sas'),
    'scala' => array('scala'),
    'scheme' => array('scm'),
    'scilab' => array('sci'),
    'smalltalk' => array('st'),
    'smarty' => array(),
    'tcl' => array('tcl'),
    'vb' => array('bas'),
    'vbnet' => array(),
    'visualfoxpro' => array(),
    'whitespace' => array('ws'),
    'xml' => array('xml', 'svg', 'xrc'),
    'z80' => array('z80', 'asm', 'inc')
);

c语言测试

//lang="c"
int main(int argc,char** argv)
{
    printf("Hello World\n");
    return 0;
}

c++语言测试

//lang="cpp"
using namespace std;
int main(int argc,char** argv)
{
    cout<<"Hello World"<<endl;
    return 0;
}
&#91;/code&#93;

Objective-C语言测试
&#91;code lang="objc"&#93;
#import <Foundation/Foundation.h>

int main(int argc, char**argv)
{
	NSString *hello = @"Hello World\n";
	NSLog(hello);
	[hello release];
	return 0;
}

java语言测试

//lang="java"
public static void main(String[] args)
{
    System.out.println("Hello World!");
}

bash脚本测试

#!/bin/bash
#lang="bash"
HI="Hello World!"
echo $HI

bat脚本测试

REM lang="bash"
echo "Hello World!"