ArchLinux下配置ssh/http代理

被墙煎的滋味确实很难受,ssh转发大家的方法还是比较方便的。

1
ssh -C -f -N -g -D port user@Server

但是很多的软件并不一定支持sock5代理,这个时候就需要将sock5代理转化为http代理。ArchLinux下的配置安装方法为:

  1. 安装Privoxy
1
sudo pacman -S privoxy
  1. 修改/etc/privoxy/config , 添加以下语句
1
2
forward-socks5   /               127.0.0.1:sock_port .
listen-address  0.0.0.0:http_port
  1. 重新启动privoxy
1
sudo /etc/rc.d/privoxy restart

Bingo! Enjoy it:)

Spark在Linux下的乱码解决

@ http://www.cnblogs.com/highriver/archive/2010/06/24/1764520.html

解决Spark乱码:

Linux下Java图形界面中文显示乱码问题往往是所合适的jre/fonts里面没有合适的字体。

比如spark会往~/.install4j里面写入最后一行,说明spark使用的jre是其自带的jre.

1
2
3
JRE_VERSION    /home/gaoyibo/work/jdk1.6.0_05    1    6    0    05
JRE_VERSION    /usr    1    6    0    0
JRE_VERSION    /home/gaoyibo/comodo/openfire/Spark/jre    1    6    0    02

所以遇到乱码问题解决:

1,找到jre路径,创建fallback文件夹

1
2
cd <path_to_spark>/Spark/jre/lib/fonts
sudo mkdir fallback

进入fallback文件夹,链接中文字体(我选的是文泉驿正黑)

1
2
3
4
cd fallback
sudo ln -s /usr/share/fonts/truetype/wqy/wqy-zenhei.ttc
sudo mkfontdir
sudo mkfontscale

git代理设置

Since someone is asking me to provide an English version about git proxy configuration in my former blog. Here it is. 1). Basically, I know two ways to use git behind a proxy.

  1. Set the http_proxy environment if git repository supports http connections.

find a proxy command to bypass the connection: connect.c

1
2
gcc -o connect connect.c
mv connect ~/bin
  1. Set up a wrapper
1
2
echo "/home/gigi/bin/connect -H proxy.bupt.edu.cn:8080 $@" >> ~/bin/proxy
chmod +x ~/bin/proxy

Here I’m using a http proxy offered by my school, which uses port 8080 The connect command also support socket proxy. Use -S host:port to indicate that.

  1. Update bashrc
1
2
echo "export CONNECT_USER=bergwolf" >> .bashrc
echo "export GIT_PROXY_COMMAND=proxexport GIT_PROXY_COMMAND=proxy" >> .bashrc

The connect command reads proxy username and password from CONNECT_USER and CONNECT_PASSWORD evironment. The default username is current login user if no CONNECT_USER is set. Password will be requested interactively if CONNECT_PASSWORD is empty. GIT_PROXY_COMMAND indicates that git should use the command “proxy”(the wrapper we setup at step 2) as its proxy_command. This can also be set in .git/config.

Now, everything we need is done. Have a try:

1
2
3
4
5
6
[gigi-Ubuntu:bin]$git clone git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
Initialized empty Git repository in /home/gigi/bin/e2fsprogs/.git/
Enter proxy authentication password for bergwolf@proxy.bupt.edu.cn:
remote: Counting objects: 24006, done.
remote: Compressing objects: 100% (4701/4701), done.
ceiving objects: 1% (241/24006), 43.99 KiB | 56 KiB/s