This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const escapedChars = { | |
"&": "&", | |
"<": "<", | |
">": ">", | |
'"': """, | |
"'": "'", | |
}; | |
const escape = str => { | |
return str.toString().replace(/[&<>\"']/g, m => escapedChars[m]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const compile = (str, data, delimiters = /<%|%>/) => { | |
const expressionRegex = /(^( )?(if|for|else|switch|case|break|{|}|let|const|var))(.*)?/g; | |
const result = [ | |
"const r = [];", | |
...str.split(delimiters).map((t, i) => { | |
return i % 2 === 0 ? `r.push(\`${t}\`);` : (t.match(expressionRegex) ? t : `r.push(${t});`); | |
}), | |
`return r.join("");`, | |
]; | |
return new Function(result.join("")).apply(data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######## | |
## | |
## #tmux commands | |
## Reload tmux configuration: tmux source ~/.tmux.conf | |
## | |
## tmux links | |
## https://tomlankhorst.nl/iterm-tmux-vim-true-color/ | |
## | |
######## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" | |
" Installation: | |
" 1. Set up vundle for vim (https://github.com/VundleVim/Vundle.vim): | |
" $ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim | |
" 2. Download this `.vimrc` file and save it in your home folder. | |
" 3. Launch vim in your console and run :PluginInstall. | |
" | |
set nocompatible | |
syntax on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Connection url | |
//mongodb://USERNAME:PASSWORD@DBHOST:DBPORT/DBNAME | |
//Import dependencies | |
var MongoClient = require('mongodb').MongoClient; | |
//Database | |
var db = null; | |
//Connect to database |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
//Remember to make the script executable | |
//chmod u+x gbackup.js | |
//Configuration | |
var rclone = '/Users/jmjuanes/bin/rclone'; //Rclone path | |
var exclude = '/srv/.bin/gbackup_exclude.txt'; //Exclude file | |
var command = '{rclone} sync {origin} gdrive:{remote} --exclude-from {exclude}'; //RClone command | |
//Import dependencies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Function for find the position in a cover array | |
function FindBinary(arr, position) | |
{ | |
//Get the min index | |
var minIndex = 0; | |
//Get the max index | |
var maxIndex = arr.length - 1; | |
//Check the array start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <string> | |
std::string data = "Abc"; | |
std::transform(data.begin(), data.end(), data.begin(), ::tolower); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
GitHub Simple OAuth | |
================================================================================= | |
## Requisites: you need the next Node.JS modules: | |
- express, v4.x | |
- express-session | |
- request | |
## Auth: Add the next urls to yor login router: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Number of elements of the array | |
const int N = 11; | |
//Function Tabulated String to array | |
void TabStringToArray(string str, string arr[]) | |
{ | |
//Aux vars | |
int pos = 0; | |
//Read all |