set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'Shougo/deoplete.nvim', { 'do': 'UpdateRemotePlugins' }
Plugin 'jiangmiao/auto-pairs'
Plugin 'ervandew/supertab'
Plugin 'NLKNguyen/papercolor-theme'
Plugin 'itchyny/lightline.vim'
call vundle#end() " required
filetype plugin indent on " required
syntax on
set number
set tabstop=4
set autoindent
set shortmess+=I
set autochdir
set noswapfile
set nobackup
set noundofile
set showmatch
set expandtab
set shiftwidth=4
set laststatus=2
set noshowmode
set cursorline
"colorscheme 256_noir
" Change highlighting of cursor line when entering/leaving Insert Mode
"highlight CursorLine cterm=NONE ctermfg=NONE ctermbg=237 guifg=NONE guibg=#121212
"autocmd InsertEnter * highlight CursorLine cterm=NONE ctermfg=NONE ctermbg=234 guifg=NONE guibg=#1c1c1c
"autocmd InsertLeave * highlight CursorLine cterm=NONE ctermfg=NONE ctermbg=233 guifg=NONE guibg=#121212
set t_Co=256
colorscheme PaperColor
set background=dark
20191010
Updated .vimrc: going back to vim from nvim
20190524
Trying out NeoVim, my init.vim
prep:
pip install pynvim && pip install neovim && pip install jedi && pip install yapf
install Plugin Manager
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
/.config/nvim/init.vim:
call plug#begin('~/.config/nvim/bundle')
Plug 'Shougo/deoplete.nvim', { 'do': 'UpdateRemotePlugins' }
Plug 'scrooloose/syntastic'
Plug 'bling/vim-airline'
Plug 'jiangmiao/auto-pairs'
Plug 'numirias/semshi', {'do': ':UpdateRemotePlugins'}
Plug 'davidhalter/jedi-vim'
Plug 'ervandew/supertab'
call plug#end()
set number
syntax on
set tabstop=4
set autoindent
set showmatch
set expandtab
set shiftwidth=4
set background=dark
set cursorline
hi Cursorline term=bold cterm=bold ctermbg=DarkBlue
hi LineNr ctermfg=grey guifg=#2b506e guibg=#000000
hi CursorLineNr term=bold ctermfg=White gui=bold guifg=Yellow ctermbg=DarkBlue
noremap Y y$
autocmd FileType python nnoremap y :0,$!yapf
autocmd CompleteDone * pclose " To close preview window of deoplete automagically
20190408
updated .vimrc
inoremap " ""<left> inoremap ' ''<left> inoremap ( ()<left> inoremap [ []<left> inoremap { {}<left> inoremap {<CR> {<CR>}<ESC>O inoremap {;<CR> {<CR>};<ESC>O set backspace=indent,eol,start set number syntax on set tabstop=4 set autoindent set cursorline hi CursorLine term=bold cterm=bold ctermbg=DarkBlue hi LineNr ctermfg=grey guifg=#2b506e guibg=#000000 hi CursorLineNr term=bold ctermfg=Yellow gui=bold guifg=Yellow ctermbg=DarkBlue set showmatch set expandtab set shiftwidth=4
20181123
python + vscode + indent + format
Indent block
Format block
- Select block
- CMD + ]
Format block
- Select block
- CMD + K, F
20181016
Python + Virtualenv + VCcode
- Install user Python (~/Library/Python/3.x/bin)
- Update PATH in .bash_profile (source .bash_profile)
- Install virtualenv: pip install virtualenv
- Change dir to project folder (e.g. my_project_folder)
- Create virtualenv (e.g. virtualenv my_project)
- Activate (e.g. source my_project/bin/activate)
- Run VSCode on project folder (e.g. code my_project)
- Change python env (⇧⌘P) to my_project/bin/python
- Enjoy
20180510
Updated vimrc
set number
syntax on
set tabstop=4
set autoindent
set cursorline
hi CursorLine term=bold cterm=bold ctermbg=DarkBlue
hi LineNr ctermfg=grey guifg=#2b506e guibg=#000000
hi CursorLineNr term=bold ctermfg=Yellow gui=bold guifg=Yellow ctermbg=DarkBlue
set showmatch
set expandtab
set shiftwidth=4
syntax on
set tabstop=4
set autoindent
set cursorline
hi CursorLine term=bold cterm=bold ctermbg=DarkBlue
hi LineNr ctermfg=grey guifg=#2b506e guibg=#000000
hi CursorLineNr term=bold ctermfg=Yellow gui=bold guifg=Yellow ctermbg=DarkBlue
set showmatch
set expandtab
set shiftwidth=4
20180419
Sending JSON data via curl
curl -i -H "Content-Type: application/json" \
-X POST -d '{"name":"Zuck","type":"Snake"}' \
http://127.0.0.1:8080/animal
-X [DELETE|POST|GET]
-X POST -d '{"name":"Zuck","type":"Snake"}' \
http://127.0.0.1:8080/animal
-X [DELETE|POST|GET]
20171229
vi tricks
:sp# opens another file in a vertical window :vs # opens another file in a horizontal window
20171220
Get website cert info via CLI
echo | openssl s_client -showcerts -servername r.inq.ph -connect r.inq.ph:443 2>/dev/null | openssl x509 -inform pem -noout -text
What's your vimrc?
set number syntax on set tabstop=2 set shiftwidth=2 set autoindent set cursorline highlight CursorLine term=bold cterm=bold ctermbg=DarkBlue set expandtab set showmatch
20170119
.bashrc / .profile
PS1="\n\[\e[30;1m\](\[\e[34;1m\]\u@\[\e[32;1m\]\h\[\e[30;1m\])-(\[\e[31;1m\]\t\[\e[30;1m\])-(\[\[\e[32;1m\]\w\[\e[30;1m\])\[\e[30;1m\]\n(jobs:\[\e[34;1m\]\j\[\e[30;1m\])\`if [ \$? -eq 0 ]; then echo \[\e[32m\] \(^_^\); else echo \[\e[31m\] \(o\.O\) ; fi\`\[\e[0m\] $ "
20140102
Installing PHP 5.2.17 on CentOS 5.x
But why? Don't ask...
Install EPEL Repo:
http://ftp.riken.jp/Linux/fedora/epel/5/i386/repoview/epel-release.html
Install CentALT:
http://centos.alt.ru/pub/repository/centos/readme.txt
done
20131203
Usefull varnish monitoring commands
varnishlog -c -m"VCL_call:hit" | grep RxURL varnishlog -c -m"VCL_call:miss" | grep RxURL varnishlog -a -w /tmp/varnish.log varnishlog -r /tmp/varnish.log varnishlog -i RxHeader -I Cookie varnishtop -i RxHeader -I \^User-Agent varnishtop -i RxRequest varnishtop -i RxHeader -I \^Host varnishtop -i RxHeader -I Cookie
20130308
Day 2: Installing MovableType 5.2.3
12:45pm: Installed Net::SMTP::TLS Net::SMTP::SSL. Seems to install right after the avalanche of installing modules did not work. Hmmm.
12:50pm: Decided not to install PSGI related modules and other DB related modules except for DBI::mysql
12:54pm: Installed perl-Crypt-SSLeay package via YUM.
1:58pm: Ran mt-check.cgi, so far so good. Ran the Configuration Wizard. Installation complete!
Next agenda:
1. Switching to nginx
2. Using custom fields
12:50pm: Decided not to install PSGI related modules and other DB related modules except for DBI::mysql
12:54pm: Installed perl-Crypt-SSLeay package via YUM.
1:58pm: Ran mt-check.cgi, so far so good. Ran the Configuration Wizard. Installation complete!
Next agenda:
1. Switching to nginx
2. Using custom fields
Day 1: Prepping Server for MovableType 5.2.3
OK, here we go. I'll blog things down as I go.
Long before WordPress, blogging dinosaurs such as myself used MovableType. I've used MT from 1.x till pre-3.x when SixApart changed the licensing model which upset a lot of MT users. The changes in MT made users move to WP. You can find more about the MT/WP history here. You can also read about the contribution I made that made its way into the book Essential Blogging from O'Reilly.
I'm using Centos 5.9 VM with 4GB of memory, 2 Processors and 80GB of space. I'll be using Apache for the webserver (I'll make it work on nginx and lighttpd afterwards), MySQL 5.0.95 and Perl 5.8.8.
2:30pm: Installed httpd and mysql client & server:
yum install httpd mysql mysql-server
2:57pm: Installed Development Tools:
yum groupinstall 'Development Tools'
3:43pm: Installed required Perl modules:
perl -MCPAN -e shell << EOJ
install CGI Image::Size File::Spec CGI::Cookie DBI DBD::mysql Archive::Tar Archive::Zip Crypt::DSA Digest::MD5 Digest::SHA1 File::Temp GD HTML::Entities HTML::Parser Image::Magick IO::Compress::Gzip IO::Uncompress::Gunzip IPC::Run List::Util LWP::UserAgent Mail::Sendmail MIME::Base64 Safe Scalar::Util SOAP::Lite Storable Text::Balanced XML::Atom XML::Parser XML::SAX
Long before WordPress, blogging dinosaurs such as myself used MovableType. I've used MT from 1.x till pre-3.x when SixApart changed the licensing model which upset a lot of MT users. The changes in MT made users move to WP. You can find more about the MT/WP history here. You can also read about the contribution I made that made its way into the book Essential Blogging from O'Reilly.
I'm using Centos 5.9 VM with 4GB of memory, 2 Processors and 80GB of space. I'll be using Apache for the webserver (I'll make it work on nginx and lighttpd afterwards), MySQL 5.0.95 and Perl 5.8.8.
2:30pm: Installed httpd and mysql client & server:
yum install httpd mysql mysql-server
2:57pm: Installed Development Tools:
yum groupinstall 'Development Tools'
3:43pm: Installed required Perl modules:
perl -MCPAN -e shell << EOJ
install CGI Image::Size File::Spec CGI::Cookie DBI DBD::mysql Archive::Tar Archive::Zip Crypt::DSA Digest::MD5 Digest::SHA1 File::Temp GD HTML::Entities HTML::Parser Image::Magick IO::Compress::Gzip IO::Uncompress::Gunzip IPC::Run List::Util LWP::UserAgent Mail::Sendmail MIME::Base64 Safe Scalar::Util SOAP::Lite Storable Text::Balanced XML::Atom XML::Parser XML::SAX
exit
EOJ
3:55pm: Drank tea while Perl downloads and install the required CPAN modules.
4:24pm: As expected, not all CPAN modules were installed. Lets see what got not installed.
5:00pm: Had to disable selinux temporarily. Noted!
5:37pm: Installed gd, gd-progs, gd-devel, ImageMagick, ImageMagick-devel & ImageMagick-perl
6:00pm: Called it a day
20130304
Working with Movable Type
In a couple of days, I'll start using Movable Type, making it work while documenting everything. wish me luck!
20111114
Count number of days in PHP
$days = ($month == 2 ? ($year % 4 ? 28 : ($year % 100 ? 29 : ($year %400 ? 28 : 29))) : (($month - 1) % 7 % 2 ? 30 : 31));
20110912
PHP 5.2.17 on CentOS 5.6 Final
I'm running Citrix Xen Server and have a 5.6 VM. However, the PHP that's on CentOS 5.6 is currently 5.1.x. Here's a script that downloads and installs the required packages to run PHP 5.2.17 (I need 5.2.17 because I'm running Wordpress 3.0.6.
wget 'http://www.atoomnet.net/./php/php-5.2.17/php-5.2.17-1.x86_64.rpm' wget 'http://www.atoomnet.net/./php/php-5.2.17/php-bcmath-5.2.17-1.x86_64.rpm' wget 'http://www.atoomnet.net/./php/php-5.2.17/php-cli-5.2.17-1.x86_64.rpm' wget 'http://www.atoomnet.net/./php/php-5.2.17/php-common-5.2.17-1.x86_64.rpm' wget 'http://www.atoomnet.net/./php/php-5.2.17/php-dba-5.2.17-1.x86_64.rpm' wget 'http://www.atoomnet.net/./php/php-5.2.17/php-devel-5.2.17-1.x86_64.rpm' wget 'http://www.atoomnet.net/./php/php-5.2.17/php-eaccelerator-5.2.17_0.9.6.1-1.x86_64.rpm' wget 'http://www.atoomnet.net/./php/php-5.2.17/php-gd-5.2.17-1.x86_64.rpm' wget 'http://www.atoomnet.net/./php/php-5.2.17/php-imap-5.2.17-1.x86_64.rpm' wget 'http://www.atoomnet.net/./php/php-5.2.17/php-ldap-5.2.17-1.x86_64.rpm' wget 'http://www.atoomnet.net/./php/php-5.2.17/php-mbstring-5.2.17-1.x86_64.rpm' wget 'http://www.atoomnet.net/./php/php-5.2.17/php-mcrypt-5.2.17-1.x86_64.rpm' wget 'http://www.atoomnet.net/./php/php-5.2.17/php-mhash-5.2.17-1.x86_64.rpm' wget 'http://www.atoomnet.net/./php/php-5.2.17/php-mssql-5.2.17-1.x86_64.rpm' wget 'http://www.atoomnet.net/./php/php-5.2.17/php-mysql-5.2.17-1.x86_64.rpm' wget 'http://www.atoomnet.net/./php/php-5.2.17/php-ncurses-5.2.17-1.x86_64.rpm' wget 'http://www.atoomnet.net/./php/php-5.2.17/php-odbc-5.2.17-1.x86_64.rpm' wget 'http://www.atoomnet.net/./php/php-5.2.17/php-pdo-5.2.17-1.x86_64.rpm' wget 'http://www.atoomnet.net/./php/php-5.2.17/php-pgsql-5.2.17-1.x86_64.rpm' wget 'http://www.atoomnet.net/./php/php-5.2.17/php-readline-5.2.17-1.x86_64.rpm' wget 'http://www.atoomnet.net/./php/php-5.2.17/php-snmp-5.2.17-1.x86_64.rpm' wget 'http://www.atoomnet.net/./php/php-5.2.17/php-soap-5.2.17-1.x86_64.rpm' wget 'http://www.atoomnet.net/./php/php-5.2.17/php-tidy-5.2.17-1.x86_64.rpm' wget 'http://www.atoomnet.net/./php/php-5.2.17/php-xml-5.2.17-1.x86_64.rpm' wget 'http://www.atoomnet.net/./php/php-5.2.17/php-xmlrpc-5.2.17-1.x86_64.rpm' yum -y install autoconf automake net-snmp libc-client libmcrypt libmhash libsybdb unixODBC freetds mysql-server rpm -Uvh *.rpm
20110908
20110907
Blocking machines on Cisco 2960 via MAC address
mac-address-table static 1caf.f735.411e vlan 1 drop
where 1caf.f735.411e is the MAC address of the machine you want to block.
Subscribe to:
Posts (Atom)