Category: Just about Code

  • 一份LaTeX中文简历

    resumecls is a LaTeX document class which can typeset resume both in Chinese and English. It’s really an honor for me that it can be included in CTAN mirror, though the first uploaded version contains some silly bugs. After reconstructing the whole project and separate a standalone sub-project as examples to use resumecls. I think it should be more usable now, and I would like to introduce it to you guys again.

    resumecls 是一个同时支持中英文来编写简历的 LaTeX 模板。虽然第一次上传的版本有很多小 bug ,但还是很高兴它能够被收录到 CTAN 镜像中。这段时间抽空重构了整个项目并且分离出了独立的样例作为子项目。现在应该挺好用了,所以在此再次介绍给大家。


    毕设交完初稿之后一直在写各种代码玩,除了修了几个开源项目的bug,还信誓旦旦的号称要写一个LaTeX简历模板,憋了好几天终于有点模样了。但是回头看实在不敢恭维是什么模板,其实整个简历就是各种不同样式的表格的拼接,LaTeX代码里也只是封装了tabularx宏包提供的表格以便能使用它的一些特性。

    简历主题风格借鉴了一个名为tucv的package,但是那个宏包中对条目的设计过于具体,而且在格式上还有一些局限性,特别是没有中文支持。所以我就写了一个样子看起来差不多的,代码也参照了一些,主要是加入了中文支持,并且简化了封装和使用。

    一个样例,也就是我的中文简历,在这里
    源代码托管在了Github上,传送门在这里

    欢迎各种修改/批评意见,也很高兴你能够帮忙测试使用。

  • 安装 Ubuntu 12.04 (Precise) 之后

    本文会不定期更新,最后更新时间 2012/06/02


    Changelog

    20120516: 优化最大化页面: gnome-shell-extension-window-buttons
    20120602: 安装Calibre: sudo apt-get install calibre


    曾经心血来潮写过一个Ubuntu的配置教程,还美其名曰《邂逅Ubuntu》系列,后来Ubuntu更新了,GNOME也变成了gnome shell,但是教程再也没更新过(惭愧不已)。适逢Ubuntu 12.04刚更新不久,简单记录下配置的流程。

    本文主要记录了安装Ubuntu 12.04 (Precise) 之后的配置美化过程,主要包含:
    1、配置软件源;2、安装配置gnome shell取代unity;3、安装相关软件;4、配置杂项。


    配置软件源
    我的策略是教育网一组,公网一组,官网一组,其次主要考虑地理位置和具体连接的速度。
    教育网推荐是使用清华、北交、上交的(其一即可),公网推荐sohu(中国官方源)、163的(同样选择其一)。
    [shell]
    # /etc/apt/sources.list
    # tsinghua
    deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ precise main multiverse restricted universe
    deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ precise-backports main multiverse restricted universe
    deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ precise-proposed main multiverse restricted universe
    deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ precise-security main multiverse restricted universe
    deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ precise-updates main multiverse restricted universe
    deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ precise main multiverse restricted universe
    deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ precise-backports main multiverse restricted universe
    deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ precise-proposed main multiverse restricted universe
    deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ precise-security main multiverse restricted universe
    deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ precise-updates main multiverse restricted universe

    # # bjtu
    # deb http://mirror.bjtu.edu.cn/ubuntu/ precise main multiverse restricted universe
    # deb http://mirror.bjtu.edu.cn/ubuntu/ precise-backports main multiverse restricted universe
    # deb http://mirror.bjtu.edu.cn/ubuntu/ precise-proposed main multiverse restricted universe
    # deb http://mirror.bjtu.edu.cn/ubuntu/ precise-security main multiverse restricted universe
    # deb http://mirror.bjtu.edu.cn/ubuntu/ precise-updates main multiverse restricted universe
    # deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise main multiverse restricted universe
    # deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise-backports main multiverse restricted universe
    # deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise-proposed main multiverse restricted universe
    # deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise-security main multiverse restricted universe
    # deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise-updates main multiverse restricted universe

    # sohu (official China)
    deb http://cn.archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
    deb http://cn.archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
    deb http://cn.archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
    deb http://cn.archive.ubuntu.com/ubuntu/ precise-proposed main restricted universe multiverse
    deb http://cn.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
    deb-src http://cn.archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
    deb-src http://cn.archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
    deb-src http://cn.archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
    deb-src http://cn.archive.ubuntu.com/ubuntu/ precise-proposed main restricted universe multiverse
    deb-src http://cn.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse

    # # 163
    # deb http://mirrors.163.com/ubuntu/ precise main restricted universe multiverse
    # deb http://mirrors.163.com/ubuntu/ precise-security main restricted universe multiverse
    # deb http://mirrors.163.com/ubuntu/ precise-updates main restricted universe multiverse
    # deb http://mirrors.163.com/ubuntu/ precise-proposed main restricted universe multiverse
    # deb http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
    # deb-src http://mirrors.163.com/ubuntu/ precise main restricted universe multiverse
    # deb-src http://mirrors.163.com/ubuntu/ precise-security main restricted universe multiverse
    # deb-src http://mirrors.163.com/ubuntu/ precise-updates main restricted universe multiverse
    # deb-src http://mirrors.163.com/ubuntu/ precise-proposed main restricted universe multiverse
    # deb-src http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse

    # official security
    deb http://security.ubuntu.com/ubuntu precise-security main restricted
    deb-src http://security.ubuntu.com/ubuntu precise-security main restricted
    deb http://security.ubuntu.com/ubuntu precise-security universe
    deb-src http://security.ubuntu.com/ubuntu precise-security universe
    deb http://security.ubuntu.com/ubuntu precise-security multiverse
    deb-src http://security.ubuntu.com/ubuntu precise-security multiverse

    # canonical partner
    deb http://archive.canonical.com/ubuntu precise partner
    deb-src http://archive.canonical.com/ubuntu precise partner

    # official extras
    deb http://extras.ubuntu.com/ubuntu precise main
    deb-src http://extras.ubuntu.com/ubuntu precise main
    [/shell]

    配置好之后记得更新升级

    [shell]
    sudo apt-get update
    sudo apt-get upgrade
    [/shell]


    安装配置gnome shell
    之前折腾过Arch、Gentoo、Mint、Deepin都是因为Ubuntu换了unity,也算因祸得福,学到了很多东西,现在可以兼容了,当然果断上之。

    安装基本桌面
    [shell]
    sudo apt-get install gnome-shell # gnome shell 桌面
    sudo apt-get install gnome-tweak-tool # 高级配置工具
    [/shell]

    安装图标和GTK主题
    [shell]
    sudo add-apt-repository ppa:tiheum/equinox # 添加图标主题PPA
    sudo add-apt-repository ppa:satyajit-happy/themes # 添加GTK主题PPA
    sudo apt-get update # 更新软件源
    sudo apt-get install faenza-icon-theme faience-icon-theme # 两款Icon theme
    sudo apt-get install evolve-gtk-theme orion-gtk-theme # 两款 GTK theme
    [/shell]
    我选择的Icon theme是Faience,Window theme和GTK+ theme都是Evolve

    安装gnome shell extension
    可以通过PPA和网站两种方式安装,主要还是个人喜好和需要,通过gnome-tweak-tool进行设置即可,这里只列出作者使用的部分
    通过PPA安装
    [shell]
    sudo add-apt-repository ppa:webupd8team/gnome3 # 添加PPA
    sudo apt-get update
    sudo apt-get install gnome-shell-extensions # 官方插件
    sudo apt-get install gnome-shell-system-monitor # 非官方系统监控插件,扩展性很强
    sudo apt-get install gnome-shell-classic-systray # 移动所有底边信息栏图标至顶部
    sudo apt-get install gnome-shell-extensions-autohidetopbar # 自动隐藏顶部功能条
    sudo apt-get install gnome-shell-extensions-mediaplayer # 集成音乐到状态栏的声音设置
    sudo apt-get install gnome-shell-extensions-noa11y # 删除accesibility按钮
    [/shell]
    通过GNOME Extensions网站安装
    个人感觉PPA提供的已经基本够用了,而且很方便更新,你也可以在网站里淘一淘

    需要注意 user-themes 插件可能有问题,导致gnome-tweak-tool无法打开或者打开报错,通过以下两条命令可以解决
    [shell]
    sudo cp ~/.local/share/gnome-shell/extensions/user-theme@gnome-shell-extensions.gcampax.github.com/schemas/org.gnome.shell.extensions.user-theme.gschema.xml /usr/share/glib-2.0/schemas/
    sudo glib-compile-schemas /usr/share/glib-2.0/schemas
    [/shell]

    安装gnome shell theme
    我有点洁癖,不喜欢下载安装,因为不方便更新,但暂时还未发现包含很合意的gnome shell theme的PPA,可以关注一下Satya的PPA(之前安装GTK主题时已经添加了)。我已经邮件和作者联系过了,确定还会维护更新的,就是需要等等。我现在安装的是London Smoke Gnome-Shell,作为暂时的选择。


    安装相关软件
    此部分列举了本人会用到的软件包,因根据个人需要选择
    [shell]
    sudo apt-get install ubuntu-restricted-extras # 有版权限制的软件
    sudo apt-get install ibus ibus-googlepinyin # ibus输入法 和 谷歌拼音输入法
    sudo apt-get install chromium-browser # Chromium 浏览器
    sudo apt-get install flashplugin-installer # flash 插件
    sudo apt-get install cheese # 摄像头软件
    sudo apt-get install gnome-mplayer vlc# 视频播放器
    sudo apt-get install gimp # PhotoShop 替代品
    sudo apt-get install pidgin # 多协议聊天
    sudo apt-get install xchat # irc聊天
    sudo apt-get install libreoffice # office
    sudo apt-get install stardict # 翻译辞典
    sudo apt-get install calibre # 电子书管理工具
    sudo apt-get install gtg # GTD 工具
    sudo apt-get install bleachbit # 系统清洁
    sudo apt-get install skype # skype
    sudo apt-get install axel # 命令行下载
    sudo apt-get install pastebinit # 命令行下上传文本至 pastebin
    sudo apt-get install dia # 图表 (UML) 制作
    sudo apt-get install synergy # 多电脑共享键鼠
    sudo apt-get install vim # 神编辑器
    sudo apt-get install git # git 版本控制
    sudo apt-get install mercurial # hg 版本控制
    sudo apt-get install subversion # svn 版本控制
    sudo apt-get install bzr bzrtools # bzr 版本控制
    sudo apt-get install octave # Matlab 替代品
    sudo apt-get install python-dev python-pip # python dev pip
    sudo apt-get install apache2 # apache 服务器
    sudo apt-get install nginx # nginx 服务器
    sudo apt-get install mysql-server mysql-client # mysql 数据库

    sudo apt-get install openvpn # 这个干什么用就不解释了
    sudo apt-get install proxychains # 命令行代理
    # 配置好proxychains (/etc/proxychains.conf) 之后即可顺利安装dropbox
    sudo proxychains apt-get install nautilus-dropbox # dropbox 文件同步

    sudo add-apt-repository ppa:tualatrix/ppa # 添加 ubuntu-tweak PPA
    sudo apt-get update # 更新软件源
    sudo apt-get install ubuntu-tweak # Ubuntu的优化大师
    [/shell]

    此外还有MongoDB数据库指纹识别fprint的安装,可以进入对应页面查看详情


    配置杂项
    安装更新语言包
    “System Settings” -> “Language Support”
    在”Install / Remove Languages…” 中选择安装 “Chinese (simplified)” 和 “English”
    最下方的输入法选择中选择ibus

    配置字体
    安装中文语言包之后会安装相应中文字体,通过gnome-tweak-tool即可配置
    我一直比较喜欢使用文泉驿的微黑(WenQuanYi Micro Hei),等宽字体也使用WenQuanYi Micro Hei Mono

    修改Chromium标题栏按钮位置问题
    由于Unity的缘故,Chromium标题栏按钮会显示在左边,通过以下命令(其一)可以解决
    [shell]
    # 让标题栏只有关闭按钮
    gconftool-2 –set /apps/metacity/general/button_layout –type string “:close”
    # 让标题栏包含常规的最小化、最大化和关闭按钮
    gconftool-2 –set /apps/metacity/general/button_layout –type string “:minimize,maximize,close”
    [/shell]

    在Startup Applications Preferences中显示开启启动项
    默认情况下很多启动项都没有显示,通过以下命令即可实现
    [shell]
    sudo sed -i ‘s/NoDisplay=true/NoDisplay=false/g’ /etc/xdg/autostart/*.desktop
    [/shell]

    优化最大化页面
    主要是来自 ppa:webupd8team/gnome3 (前面已经配置)的新插件 window-buttons
    [shell]
    sudo apt-get install gnome-shell-extension-window-buttons # 将窗口标题栏最大/小化和关闭按钮移至上方的通知栏
    sudo apt-get install dconf-tools # 配置插件插件需要用到的工具
    sudo apt-get install maximus # 取消最大化时的标题栏
    sudo apt-get install gconf-editor # 配置 maximus 需要用到的工具
    [/shell]

    1)在 gconf-editor 中,进入 apps > maximus
    1.1)启用 ‘no_maximus’
    2)在 dconf-editor 中,进入 org > gnome > shell > extensions > window-buttons,
    2.1)启用 “onlymax” 和 “hideonnomax” 窗口(如桌面和gnomw-tweak-tool)不支持最大化时隐藏标题栏中的按钮
    2.2)其他 theme 、 order 之类的可以根据自己的喜好修改


    其他主要是根据个人喜好修改系统和相应软件的设置
    至此,基本配置完毕,欢迎交流和提出改进意见

  • 在Ubuntu上安装MongoDB

    由于Ubuntu版本发行的规则,版本库里往往不是最新的组建,所以有时候需要使用官方的PPA进行补充,例如MongoDB,版本库里的版本连UTF-8都不支持。官方已经有很详细的解释说明,这里主要是复述记录一下。

    废话不多说,上代码:
    [shell]
    # Add GPG key 添加GPG密钥
    apt-key adv –keyserver keyserver.ubuntu.com –recv 7F0CEB10

    # Add source list 添加软件源
    echo “deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen” > /etc/apt/sources.list.d/mongodb.list

    # update and install 更新软件源并安装
    apt-get update
    apt-get install mongodb-10gen
    [/shell]

    这里也有一个简单的脚本实现自动安装,拷贝到单独的文件中,运行”sudo sh 文件名”即可。