Skip to content

Instantly share code, notes, and snippets.

View ssilva's full-sized avatar

Saulo Silva ssilva

View GitHub Profile
@ssilva
ssilva / main.c
Last active September 12, 2017 02:12
msgpack neovim c client proof of concept
#include <stdio.h>
#include <unistd.h>
#include <sys/socket.h>
#include <msgpack.h>
/*
* $ NVIM_LISTEN_ADDRESS=127.0.0.1:8888 nvim
*
*/
@ssilva
ssilva / coding-style.rst
Created September 4, 2017 17:34
Linux kernel coding style

Linux kernel coding style

This is a short document describing the preferred coding style for the linux kernel. Coding style is very personal, and I won't force my views on anybody, but this is what goes for anything that I have to be able to maintain, and I'd prefer it for most other things too. Please at least consider the points made here.

Command-line

Sum of numbers

Pipe to awk '{s+=$1} END {print s}' or paste -s -d+ - | bc (here paste joins the numbers into one line)

vim

  • { extends the selection until the next empty line

Macros

{
"Version":"2012-10-17",
"Statement":[{
"Sid":"PublicReadGetObject",
"Effect":"Allow",
"Principal": "*",
"Action":["s3:GetObject"],
"Resource":["arn:aws:s3:::example.com/*"
]
}
#!/bin/bash
# Simple, ad-hoc script to quickly bootstrap a fresh Vim install.
echo -n "This will overwrite your .vimrc and plugins. Do you wish to continue [y/N]? "
read answer
if ! echo "$answer" | grep -iq "^y"; then
exit
fi
execute pathogen#infect()
"execute pathogen#helptags()
" Suggested Pathogen plugins
" https://github.com/tpope/vim-commentary.git
" https://github.com/tpope/vim-obsession.git
" https://github.com/tpope/vim-sensible.git
" https://github.com/tpope/vim-markdown.git
" https://github.com/itchyny/lightline.vim
" https://github.com/terryma/vim-multiple-cursors.git
" https://github.com/mhinz/vim-signify
@ssilva
ssilva / DisableEnableNetworkAdapter.ps1
Created November 23, 2012 19:16
How to disable & enable a network adapter on Windows with PowerShell
# Get the network adapter object
$adapter = Get-WmiObject -Class Win32_NetworkAdapter |
Where-Object {$_.Name -eq "TP-LINK Wireless USB Adapter"}
# Disable it
Write-Host -nonew "Disabling $($adapter.Name)... ";
$result = $adapter.Disable()
if ($result.ReturnValue -eq -0) {
Write-Host "Success.";
} else {