Skip to content

Instantly share code, notes, and snippets.

View liorrozen's full-sized avatar

Lior Rozen liorrozen

View GitHub Profile
@liorrozen
liorrozen / can-haz
Last active May 3, 2017 08:14
Alias "can-haz" to "sudo apt-get" allowing you to run commands like "can-haz apache2".
alias can-haz="sudo apt-get install"
# Autocomplete function
_can-haz() {
cur=`_get_cword`
COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
return 0
}
complete -F _can-haz can-haz
@liorrozen
liorrozen / code-spice.md
Last active August 29, 2015 13:58
Look at your code.

Hello coders,

Look at your code.
Now look at mine.
Now back to your code
Now back to MINE!

Sadly, your code does not render correctly.
But if you stopped using IE and switched to Chrome;
Your code would render correctly.

<script>
var user_already_annoyed = false;
window.onbeforeunload = function() {
if ( !user_already_annoyed ){
lpTag.vars.push([{ scope:"page", name:"tryclose", value:"true" }]);
lpTag.vars.send();
user_already_annoyed = true;
return "Please don't leave just yet. Click 'stay on this page' for a nice discount!";
}
}
@liorrozen
liorrozen / tmux-ssh-sesstion
Last active February 26, 2017 11:23
Tmux scripting
#!/bin/bash
SESSION=sess_name
PROJ_FOLDER=proj_name
cd $PROJ_FOLDER
# if the session is already running, attach to it.
tmux has-session -t $SESSION
if [ $? -eq 0 ]; then
@liorrozen
liorrozen / .tmux.conf
Last active June 27, 2016 22:51
My tmux.conf
# Reset Prefix
set -g prefix C-a
# Escape time
set -s escape-time 0
# large history
set-option -g history-limit 10000
# don't rename window
@liorrozen
liorrozen / minimal_vimrc
Last active December 30, 2016 08:23
A sane, pluginless vimrc configuration
" Behavior
" =======
set nocompatible " disable vi backwards compatibilty
set backspace=indent,eol,start " fixes backspace & del behavior
set timeoutlen=1000 ttimeoutlen=0 " No delay for ESC
nmap Q <nop> " disable ex mode prompt
set autoread " Automatically reload files that have been changed outside of Vim
set confirm " confirm before exiting if files have not been saved
set hidden " Hide buffers when they are abandoned
@liorrozen
liorrozen / programming-languages-religions
Last active August 29, 2015 14:10
If programming languages were religions...
Originally from http://www.aegisub.net/2008/12/if-programming-languages-were-religions.html
If programming languages were religions...
By amz at 14:52
"If programming languages were religions"
(Inspired by "If programming languages were cars")
C would be Judaism - it's old and restrictive, but most of the world is familiar with its laws
@liorrozen
liorrozen / generate_sql.rb
Created November 5, 2015 12:58
Generate an INSERT sql statement from an existing active record
u.class.arel_table.create_insert.tap { |im| im.insert(u.send(:arel_attributes_with_values_for_create,u.attribute_names)) } .to_sql
@liorrozen
liorrozen / gist:a047ff99edbab1997c73
Last active February 12, 2016 16:22
My settings for cVim
set noautofocus " The opposite of autofocus; this setting stops
" sites from focusing on an input box when they load
set typelinkhints
" this will enable the config block below on the domain 'reddit.com'
site '*://github.com/*' {
unmap t
}
" alias ':g' to ':tabnew google'
command g tabnew google
Delivered-To: xxxxxx+stackoverflow@gmail.com
Received: by 10.28.147.212 with SMTP id v203csp791636wmd;
Thu, 23 Jun 2016 19:51:18 -0700 (PDT)
X-Received: by 10.66.149.66 with SMTP id ty2mr3240418pab.153.1466736678659;
Thu, 23 Jun 2016 19:51:18 -0700 (PDT)
Return-Path: <lauren@wiotw.io>
Received: from aug.oneclickunsub.com (aug.oneclickunsub.com. [72.87.249.58])
by mx.google.com with ESMTPS id h80si3715536pfj.46.2016.06.23.19.51.18