Skip to content

Instantly share code, notes, and snippets.

[program:tomcat6]
command=/opt/tomcat6-instance/bin/supervisor-wrapper.sh
# Change Java Runtime:
sudo update-alternatives --config java
# Delete Open-JDK
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
# Change fonts - remove hinting:
http://askubuntu.com/questions/32624/ugly-fonts-in-netbeans-how-can-i-make-it-use-the-system-font
# Change RubyMine AntiAliasing first:
@rasefon
rasefon / ga.rb
Last active August 29, 2015 14:13
ga
$pm = 0.01
$cluster_num = 20
$result = nil
def gen_rands(n, lb, rb)
rands = []
n.times do
r = rand(lb..rb)
rands << r
end
阿里云服务器默认是没有swap的。而且阿里云服务器中在/etc/rc.d/rc.local脚本中将所有fstab中要求挂载的swap分区都给关闭了。所以在阿里云服务器上添加swap分区,重启之后都会失效。
建立swap分区(1GB为例)
我们在var目录下建立一个swap分区文件,命名为swapfile。使用该文件启动swap。
这里我们创建的是1G的swap分区,需要更大的可以自行修改下面的数据。
dd if=/dev/zero of=/var/swapfile bs=1024 count=1048576
/sbin/mkswap /var/swapfile
/sbin/swapon /var/swapfile
自动挂载
@rasefon
rasefon / nginx.conf
Last active August 29, 2015 14:12 — forked from jtimberman/nginx.conf
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: nginx init.d dash script for Ubuntu <=9.10.
# Description: nginx init.d dash script for Ubuntu <=9.10.
### END INIT INFO
" Highlight All Function "
syn match cFunction display "[a-zA-Z_][a-zA-Z_0-9]\{-1,}\s\{-0,}(\{1}"ms=s,me=e-1
hi cFunction gui=NONE guifg=#FFD700
@rasefon
rasefon / zsh.md
Created December 25, 2013 12:51 — forked from tsabat/zsh.md
@rasefon
rasefon / si.rb
Last active March 21, 2016 02:03
Similar Image Compare
require 'RMagick'
$scale_size = 256.0
$img_fn1 = ARGV[0]
$img_fn2 = ARGV[1]
$scale_size = ARGV[2].to_f if ARGV[2]
def calculate_threshold(img_fn)
dir_name = File.dirname(img_fn)
$dist_dir = ARGV[0]
$total_line_count = 0
$blank_line_count = 0
$code_line_count = 0
$src_exts = [".h", ".c", ".rb"]
$exclude_dirs = [".", ".."]
def traverse(entry)
entries = Dir.entries(entry)
$exclude_dirs.each { |ed| entries.delete(ed) }
@rasefon
rasefon / .vimrc
Last active December 19, 2015 23:28
vimrc for ubuntu.
set nocompatible
"Close vi compatible mode
set nocp
" Settings for vundle
filetype off
set rtp+=~/.vim/bundle/vundle
call vundle#rc()
" let Vundle manage Vundle
" required!