Skip to content

Instantly share code, notes, and snippets.

@juliojgarciaperez
juliojgarciaperez / express-api-auth.md
Last active June 8, 2019 09:50
Express API auth guide

1. install packages

npm i bcrypt connect-mongo express-session passport passport-local

2. Add passport config

configs/passport.config.js

// use with nodemailer 4.7.0
// $ npm i [email protected]
// exec as:
// $ MAIL_USER=yourmail MAIL_PASS=yourpass node nodemailer-example.js
const nodemailer = require('nodemailer');
const user = process.env.MAIL_USER
const pass = process.env.MAIL_PASS
@juliojgarciaperez
juliojgarciaperez / drone-equinox.py
Last active March 29, 2019 09:49
Drone Equinox
from pyparrot.Minidrone import Mambo
from pyparrot.DroneVision import DroneVision
from pynput.keyboard import Key, Listener
import cv2
import threading
import face_recognition
import os
import time
print("Identificando super villano...")
@juliojgarciaperez
juliojgarciaperez / mailer.service.js
Created July 17, 2018 17:46
Simple mailer service example
const nodemailer = require('nodemailer');
const transporter = nodemailer.createTransport({
service: 'Gmail',
auth: {
user: process.env.EMAIL_SENDER,
pass: process.env.EMAIL_PASSWORD
}
});
@juliojgarciaperez
juliojgarciaperez / shuttle_alias.rb
Created December 1, 2017 15:17
Shuttle to bash alias
require 'json'
if ARGV.length != 1
puts 'usage: ruby shuttle_alias.rb path_to_shuttle_config.json'
exit
end
config = JSON.parse File.read(ARGV[0])
puts '# Alias from Shuttle'
require 'mechanize'
require 'pry'
L = 'https://www.facebook.com/v2.6/dialog/oauth?redirect_uri=fb464891386855067%3A%2F%2Fau' \
'thorize%2F&scope=user_birthday,user_photos,user_education_history,email,user_relatio' \
'nship_details,user_friends,user_work_history,user_likes&response_type=token%2Csigned' \
'_request&client_id=464891386855067'.freeze
USER_AGENT = 'Mozilla/5.0 (Linux; U; en-gb; KFTHWI Build/JDQ39) AppleWebKit/535.19 (KHTML' \
', like Gecko) Silk/3.16 Safari/535.19'.freeze