Skip to content

Instantly share code, notes, and snippets.

@holms
holms / mpnml
Created Jul 19, 2012
Mysql, Php-fpm, Nginx, mysql-pdo, pear on OSX Mountain Lion
View mpnml
sudo port -v install mysql5-server
# Don't do any post-install instructions
sudo -u _mysql mysql_install_db5
# if above command produce this error: ERROR: 1004 Can't create file '/var/tmp/#sqle967_1_0.frm' (errno: 9)
# do this:
# sudo chown -R mysql:mysql /opt/local/var/db/mysql5
# sudo chmod u+rwx,go= /opt/local/var/db/mysql5
# sudo /opt/local/lib/mysql5/bin/mysql_install_db --user=mysql
@holms
holms / gist:3216932
Created Jul 31, 2012
RVM and ruby 1.9 on debian wheezy
View gist:3216932
0) login as root (su or sudo -s)
1) After a Debian fresh install you should install those package:
apt-get install autoconf automake autotools-dev build-essential bison bzip2 curl git libreadline5 libsqlite3-0 sqlite3 libsqlite3-dev libxml2-dev libmysqlclient-dev libreadline5-dev libruby openssl libssl-dev zlib1g zlib1g-dev zlibc vim
2) Install rvm
bash < <(curl -BL https://rvm.beginrescueend.com/install/rvm)
3) Add to /etc/profile and /root/.bashrc this script
@holms
holms / nginx_cakephp
Created Nov 20, 2012
Nginx rules for cakephp
View nginx_cakephp
# If the file exists as a static file serve it
# directly without running all
# the other rewite tests on it
if (-f $request_filename) {
break;
}
if (!-f $request_filename) {
rewrite ^/(.+)$ /index.php?url=$1 last;
break;
View centos-vimrc
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
set fileencodings=utf-8,latin1
endif
set nocompatible " Use Vim defaults (much better!)
set bs=indent,eol,start " allow backspacing over everything in insert mode
"set ai " always set autoindenting on
"set backup " keep a backup file
set viminfo='20,\"50 " read/write a .viminfo file, don't store more
" than 50 lines of registers
@holms
holms / gist:4252711
Created Dec 10, 2012
My freebsd mk.conf
View gist:4252711
CPUTYPE?=nocona
CFLAGS+=-Os -pipe -fno-strict-aliasing
COPTFLAGS=-Os -pipe -funroll-loops -ffast-math -fno-strict-aliasing
KERNCONF=BSD GENERIC
OPTIMIZED_CFLAGS=YES
WITHOUT_X11=YES
BUILD_OPTIMIZED=YES
WITH_CPUFLAGS=YES
WITH_OPTIMIZED_CFLAGS=YES
#WITHOUT_DEBUG=YES
@holms
holms / gist:4507731
Created Jan 11, 2013
FreeBSD: High resolution console
View gist:4507731
cd /usr/src/sys/amd64/conf
vi GENERIC #:
options VESA # Build VESA module into kernel
options SC_PIXEL_MODE # Allows syscons to act on pixels rather than text
cd /usr/src
make buildkernel KERNCONF=GENERIC
make installkernel KERNCONF=GENERIC
reboot
@holms
holms / gist:4984738
Created Feb 19, 2013
git svn multiple trunks
View gist:4984738
mkdir pkgname
cd pkgname
git svn init https://host/svn/pkgname/trunk/pkgname/src/trunk
git svn fetch
@holms
holms / gist:5005487
Created Feb 21, 2013
compare two directories, exclude .svn dir
View gist:5005487
diff --exclude=".svn" -rq ~/mounts/www.example.com/ /var/www/www.example.com/
@holms
holms / gist:5005629
Last active Apr 24, 2021
midnight commander dark color theme
View gist:5005629
Edit mc’s ini file (either ~/.mc/ini or ~/.config/mc/ini) and look for the line [Colors]. Then, change the line base_color to this:
[Colors]
base_color=linux:normal=white,black:marked=yellow,black:input=,green:menu=black:menusel=white:menuhot=red,:menuhotsel=black,red:dfocus=white,black:dhotnormal=white,black:dhotfocus=white,black:executable=,black:directory=white,black:link=white,black:device=white,black:special=white,black:core=,black:stalelink=red,black:editnormal=white,black
@holms
holms / wheezy.sh
Last active Dec 14, 2015
debian wheezy update and basic server setup script
View wheezy.sh
#!/bin/bash
# Text color variables
txtund=$(tput sgr 0 1) # Underline
txtbld=$(tput bold) # Bold
bldred=${txtbld}$(tput setaf 1) # red
bldblu=${txtbld}$(tput setaf 4) # blue
bldwht=${txtbld}$(tput setaf 7) # white
txtrst=$(tput sgr0) # Reset
info=${bldwht}*${txtrst} # Feedback