$mod refers to the modifier key (alt by default)
startx i3start i3 from command line$mod+<Enter>open a terminal$mod+dopen dmenu (text based program launcher)$mod+rresize mode ( or to leave resize mode)$mod+shift+eexit i3
| function! s:ExecuteInShell(command) | |
| let command = join(map(split(a:command), 'expand(v:val)')) | |
| let winnr = bufwinnr('^' . command . '$') | |
| silent! execute ':w' | |
| silent! execute winnr < 0 ? 'vnew ' . fnameescape(command) : winnr . 'wincmd w' | |
| setlocal buftype=nowrite bufhidden=wipe nobuflisted noswapfile nowrap number | |
| silent! execute 'silent %!'. command | |
| silent! redraw | |
| silent! execute 'au BufUnload <buffer> execute bufwinnr(' . bufnr('#') . ') . ''wincmd w''' | |
| silent! execute 'nnoremap <silent> <buffer> <LocalLeader>r :call <SID>ExecuteInShell(''' . command . ''')<CR>' |
$ tmux # start tmux server
$ tmux at # attach running sessions to a terminal
$ tmux ls # list running tmux sessions
$ tmux new -s session_name # make new named session
$ tmux at -t session_name # attach to exist session (allowing shared sessions)
| /* | |
| * node-ws - pure Javascript WebSockets server | |
| * Copyright Bradley Wright <[email protected]> | |
| */ | |
| // Use strict compilation rules - we're not animals | |
| 'use strict'; | |
| var net = require('net'), | |
| crypto = require('crypto'); |
| /* Extend the Underscore object with the following methods */ | |
| // Rate limit ensures a function is never called more than every [rate]ms | |
| // Unlike underscore's _.throttle function, function calls are queued so that | |
| // requests are never lost and simply deferred until some other time | |
| // | |
| // Parameters | |
| // * func - function to rate limit | |
| // * rate - minimum time to wait between function calls | |
| // * async - if async is true, we won't wait (rate) for the function to complete before queueing the next request |
| For those unfamiliar with 'advanced' i/o redirection in bash: | |
| 1) 2>&- ("close output file descriptor 2", which is stderr) has the same result as 2> /dev/null; | |
| 2) >&2 is a shortcut for 1>&2, which you may recognize as "redirect stdout to stderr". | |
| See the Advanced Bash Scripting Guide i/o redirection page for more info. | |
| – mikewaters Dec 21 '11 at 19:48 | |
| -comment from : https://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script |
Add a one-sentence description of this project. and a link to the live demo.
| /* | |
| Sort array of objects based on another array | |
| Original function: | |
| function mapOrder (array, order, key) { | |
| array.sort( function (a, b) { | |
| var A = a[key], B = b[key]; | |
| if (order.indexOf(A) > order.indexOf(B)) { | |
| return 1; | |
| } else { |
| function RateLimit(fn, delay, context) { | |
| var queue = [], timer = null; | |
| function processQueue() { | |
| var item = queue.shift(); | |
| if (item) | |
| fn.apply(item.context, item.arguments); | |
| if (queue.length === 0) | |
| clearInterval(timer), timer = null; | |
| } |
| // Author: Renat Tuktarov ([email protected]) | |
| const retry = function(fn, prev) { | |
| return new Promise((current, reject) => { | |
| const resolve = _ => (prev && prev()) || current(); | |
| fn(resolve, delay => { | |
| setTimeout(_ => { | |
| retry(fn, resolve); | |
| }, delay); |