Skip to content

Instantly share code, notes, and snippets.

View n1lux's full-sized avatar
🎯
Focusing

Nilo Alexandre Pereira n1lux

🎯
Focusing
  • Grupo Boticário
  • Poços de Caldas - MG
  • 16:58 (UTC -12:00)
View GitHub Profile
@n1lux
n1lux / django-angular-initial-config.js
Last active January 20, 2016 00:04
angular config interpolate and csrf token
var app = angular.module('app',['ngCookies', 'ui.bootstrap'],
// Change interpolation symbols
function ($interpolateProvider) {
$interpolateProvider.startSymbol('{$');
$interpolateProvider.endSymbol('$}');
});
app.config(['$httpProvider', function($httpProvider) {
// Change content type for POST so Django gets correct request object
$httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
@n1lux
n1lux / make_checkboxes.js
Last active January 13, 2016 19:07
checkboxes from json
/********************************************************************
Build checkboxes
params: obj= threat object,
list_all_input = all inputs received,
checkbox_id = checkbox id
type=type data
*********************************************************************/
function build_checkboxes(obj, list_all_input, array_checked_obj, checkbox_id, type_data){
/* Build control types checkboxes */
$(checkbox_id).empty();
// using jQuery
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
@n1lux
n1lux / list_sorted_by_key_ex.py
Created July 20, 2016 15:57
Sorted list by key
r = sorted(list(), key=lambda x: x['key'], reverse=True)
@n1lux
n1lux / ajax_callback.js
Created August 11, 2016 14:31
Ajax Call Back
function my_function(id) {
var system = getajaxdata(name);
system.done(function(data){
var information = data.info;
// do stuff with `information` here, not elsewhere.
});
}
function getajaxdata(name){
@n1lux
n1lux / vimrc
Last active October 28, 2016 19:55
Basic vimrc for python
filetype plugin indent on
set encoding=utf8
set paste
set expandtab
set textwidth=0
set tabstop=4
set softtabstop=4
set shiftwidth=4
set autoindent
set backspace=indent,eol,start
esc - modo de navegação
i - insert
I - Insere no começo da linha
a - um caracter a frente
A - Insere no final da linha
o - insere na próxima linha (linha de baixo)
O - insere na linha de cima
@n1lux
n1lux / wireless_linux.txt
Created October 28, 2016 14:50
how to set up wireless linux by commands
# Check that the wireless device is up
ip link show wlan0
# wlan0 UP
ip link set wlan0 up
ip link show wlan0
# Check the connection status
iw wlan0 link
@n1lux
n1lux / enc.py
Last active September 20, 2017 20:56
import unittest
from collections import namedtuple
DIGRAM_TABLE = [
['E', 'S', 'P', 'I', 'A'],
['O', 'B', 'C', 'D', 'F'],
['G', 'H', 'K', 'L', 'M'],
['N', 'Q', 'R', 'T', 'U'],
['V', 'W', 'X', 'Y', 'Z']
@n1lux
n1lux / bash-shortcuts.txt
Last active August 12, 2022 18:15
Bash Shortcuts
Ctrl + a – go to the start of the command line
Ctrl + e – go to the end of the command line
Ctrl + k – delete from cursor to the end of the command line
Ctrl + u – delete from cursor to the start of the command line
Ctrl + w – delete from cursor to start of word (i.e. delete backwards one word)
Ctrl + y – paste word or text that was cut using one of the deletion shortcuts (such as the one above) after the cursor
Ctrl + xx – move between start of command line and current cursor position (and back again)
Alt + b – move backward one word (or go to start of word the cursor is currently on)
Alt + f – move forward one word (or go to end of word the cursor is currently on)
Alt + d – delete to end of word starting at cursor (whole word if cursor is at the beginning of word)