Skip to content

Instantly share code, notes, and snippets.

View josuesasilva's full-sized avatar

Josué Santos josuesasilva

View GitHub Profile
@josuesasilva
josuesasilva / _vimrc
Last active December 11, 2015 04:49
Configurações básicas do Vim no Windows.
set noswapfile
set backupdir=C:\Windows\Temp
set guifont=Consolas:h11
set fileencoding=utf-8
map <F5> <esc>:!python %<cr>
set guioptions-=L "remove left-hand scroll
@josuesasilva
josuesasilva / 10-evdev.conf
Created January 27, 2013 15:47
Teclado abnt2 fluxbox e openbox. Editar arquivo /etc/X11/xorg.conf.d/10-evdev.conf
Section "InputClass"
Identifier "evdev keyboard catchall"
MatchIsKeyboard "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
Option "XkbLayout" "br"
Option "XkbVariant" "abnt2"
EndSection

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@josuesasilva
josuesasilva / gist:7355767
Created November 7, 2013 14:46
Get current selected in select box with jQuery.
<select>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="vw">VW</option>
<option value="audi" selected>Audi</option>
</select>
<a href="#">click!</a>
<script>
$(function(){
var selectVal = $('select :selected').val();
@josuesasilva
josuesasilva / api.js
Created November 10, 2013 17:37 — forked from fwielstra/api.js
/* The API controller
Exports 3 methods:
* post - Creates a new thread
* list - Returns a list of threads
* show - Displays a thread and its posts
*/
var Thread = require('../models/thread.js');
var Post = require('../models/post.js');
@josuesasilva
josuesasilva / .vimrc
Created March 17, 2014 13:17
Vim basic setup
set nocompatible " choose no compatibility with legacy vi
syntax enable
set encoding=utf-8
ffs=unix,dos
set showcmd " display incomplete commands
filetype plugin indent on " load file type plugins + indentation
"" Whitespace
set nowrap " don't wrap lines
set tabstop=2 shiftwidth=2 " a tab is two spaces
@josuesasilva
josuesasilva / setup-go.sh
Last active December 18, 2016 03:25
Bash script for fast setting up Golang environment
#!/bin/bash
#
# Bash script for fast setting up Golang environment
#
# Usage:
#
# chmod +x setup-go.sh
#
# or
@josuesasilva
josuesasilva / install-git.sh
Last active August 29, 2015 14:05
Script to download and install Git from source on Ubuntu 14.04
#!/bin/bash
# to install:
# wget --no-check-certificate http://tiny.cc/yg4zkx -O - | sh
cd ~/
install_path="$(pwd)/git"
wget https://www.kernel.org/pub/software/scm/git/git-2.1.0.tar.gz
tar -xzvf git-2.1.0.tar.gz
cd git-2.1.0/
./configure --prefix="$install_path" https://www.kernel.org/pub/software/scm/git/git-2.1.0.tar.gz
cat /proc/modules | cut -f 1 -d " " | while read module; do \
echo "Module: $module"; \
if [ -d "/sys/module/$module/parameters" ]; then \
ls /sys/module/$module/parameters/ | while read parameter; do \
echo -n "Parameter: $parameter --> "; \
cat /sys/module/$module/parameters/$parameter; \
done; \
fi; \
echo; \
done
@josuesasilva
josuesasilva / bcast.js
Last active June 7, 2017 14:03
Broadcast UPD Node.js
var dgram = require('dgram');
var server = dgram.createSocket("udp4");
// server
server.bind(function() {
server.setBroadcast(true)
server.setMulticastTTL(128);
broadcastNew();
});