Skip to content

Instantly share code, notes, and snippets.

@ampvchen
ampvchen / .vim
Created Mar 21, 2014
Vim Remove Trailing Whitespaces
View .vim
" Strip trailing whitespace
function! <SID>StripTrailingWhitespaces()
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
%s/\s\+$//e
" Clean up: restore previous search history, and cursor position
let @/=_s
View keybase.md

Keybase proof

I hereby claim:

  • I am ampvchen on github.
  • I am vchen (https://keybase.io/vchen) on keybase.
  • I have a public key ASDdoNZZbipD6WApuASbI5sUfNbu6QD-Z6LjjLJLl5Ti-wo

To claim this, I am signing this object:

@ampvchen
ampvchen / CapsLkCtrl.reg
Created Jul 12, 2017
Change the CapsLk to Ctrl on Windows
View CapsLkCtrl.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00
View ssl-redirect.rb
def ensure_domain
if Rails.env.production?
if request.host.split(".")[1].to_s != 'herokuapp' && request.subdomain != 'www'
redirect_to request.url.sub('//', '//www.')
end
end
end
View .vimrc.*
" .vimrc.before
let g:airline_powerline_fonts = 1
" .vimrc.after
" Strip trailing whitespace
function! <SID>StringTrailingWhitespaces()
" Preparation: save last search, and cursor positoin
let _s=@/
@ampvchen
ampvchen / nvidia-drivers.bash
Last active Jul 19, 2017
Install Nvidia drivers
View nvidia-drivers.bash
# Set blacklist
# /etc/modprobe.d/blacklist.conf
blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off
# Edit Grub
@ampvchen
ampvchen / keymap.cson
Created Jul 27, 2017
Fix ctrl-tab to change tabs
View keymap.cson
'body':
'ctrl-tab ^ctrl': 'unset!'
'ctrl-tab': 'pane:show-next-item'
'ctrl-shift-tab ^ctrl': 'unset!'
'ctrl-shift-tab': 'pane:show-previous-item'
@ampvchen
ampvchen / Vagrantfile
Last active May 6, 2019
Ruby Vagrant
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
RUBY_ARCHIVE = {
"linux" => "ruby-2.4.1",
}
INSTALL = {
"linux" => "apt-get update -qq; apt-get install -qq -y git curl tmux zsh ",
}.freeze