Skip to content

Instantly share code, notes, and snippets.

View thosil's full-sized avatar

Thomas Silvestre thosil

View GitHub Profile
@thosil
thosil / .vimrc
Created November 17, 2020 19:32
my .virmc
" Install vim-plug if not found
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
"" Run PlugInstall if there are missing plugins
"if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
" autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
@thosil
thosil / get_default_interface.js
Created July 31, 2019 13:46
Node.js get default interface (not tested with multiple ip on the same interface)
#!/usr/bin/env node
const os = require("os");
const util = require("util");
const fs = require("fs");
const readFile = util.promisify(fs.readFile);
readFile("/proc/net/route")
.then(body => {
const intf = body.toString()