Skip to content

Instantly share code, notes, and snippets.

Avatar

Nelson do Vale Oliveira ndvo

View GitHub Profile
@ndvo
ndvo / watchmore.sh
Last active Aug 1, 2020
System limit for number of file watchers reached
View watchmore.sh
sudo sysctl -w fs.inotify.max_user_watches=100000
@ndvo
ndvo / mymodule.module
Created Jul 30, 2020
Add a js to a specific page from a module in Drupal
View mymodule.module
function mymodule_preprocess_page(&$variables) {
if (isset($variables['node']) && $variables['node']->type == 'book') {
// Add js
drupal_add_js(drupal_get_path('module', 'mymodule') . '/mymodule.awesome.js');
$variables['scripts'] = drupal_get_js();
}
}
@ndvo
ndvo / contido.sh
Last active Apr 2, 2020
Verifica se um arquivo está contido em outro. A ordem não é importante.
View contido.sh
#!/bin/bash
primeiro=$1;
segundo=$2;
for linha in $(cat $primeiro); do
if ! [[ $(grep "^$linha$" $segundo) ]]; then
echo "$primeiro não está contido em $segundo";
exit 1;
fi;
done;
exit 0;
@ndvo
ndvo / .vimrc
Last active Sep 27, 2019
vimrc
View .vimrc
let mapleader = " "
set backupdir=.backup/,~/.backup/,/tmp//
set directory=.swp/,~/.swp/,/tmp//
set undodir=.undo/,~/.undo/,/tmp//
set undofile
packloadall " Load all plugins.
silent! helptags ALL " Load help files for all plugins.
@ndvo
ndvo / challengeTableFilter.js
Created Aug 8, 2019
A js filter manipulating DOM (answer to an exercise)
View challengeTableFilter.js
console.log("Initializing mySearch");
var filter=document.getElementById('myfilter')
buildForm(filter, filterTable)
function filterTable(){
this.table.setAttribute('id', 'deu-certo')
@ndvo
ndvo / newbug
Created Jun 6, 2019
Create a text file for a bug using vim
View newbug
#!/bin/bash
hoje=`date +%Y-%m-%d`
LAST=$(find . -maxdepth 1 -name $hoje-"*.bug" -type f -printf "%p\n" | sed -e s/.\\/$hoje-//g -e s/.bug//g | sort -g | tail -1)
echo $hoje-$(($LAST + 1)).bug
View nativescript.sh
source ~/scripts/android.sh
nvm use node
sudo update-alternatives --config java
export JAVA_HOME=$(update-alternatives --query javac | sed -n -e 's/Best: *\(.*\)\/bin\/javac/\1/p')
export J2REDIR=''
export J2SDKDIR=''
source ~/scripts/fixjava.sh
View keyboard.sh
setxkbmap -layout br -variant nativo
View vpncc.sh
snx -s 000.000.000.000 -u nelson@domain.com
You can’t perform that action at this time.