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
// JWT authentication middleware example. | |
// Uses RS256 strategy with .pem key pair files. | |
const fs = require('fs'); | |
const jwt = require('jsonwebtoken'); | |
module.exports = (req, res, next) => { | |
let publicKey = process.env.PUBLIC_KEY; |
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
$ openssl genrsa -des3 -out private.pem 2048 | |
$ openssl rsa -in private.pem -outform PEM -pubout -out public.pem |
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
# To connect this middleware.rb file to your sinatra app | |
# add 'use JWTAuthorization' as one of your first lines in | |
# your Application class. | |
# e.g. | |
# require 'middlewares.rb' | |
# class Application < Sinatra::Base | |
# use JWTAuthorization | |
# ... | |
# end |
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
// User sign-in route with JWT RSA algorithm example | |
var User = require('../models/user') | |
var express = require('express'); | |
var router = express.Router(); | |
const mongoose = require('mongoose'); | |
const bcrypt = require('bcrypt'); | |
const jwt = require('jsonwebtoken'); | |
const fs = require('fs'); | |
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
from django.db import models | |
class Something(models.Model): | |
name = models.CharField(max_length=200) | |
@staticmethod | |
def find_by_name(name): | |
try: | |
something = Something.objects.get(name=name) |
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
# pip install pyautogui | |
# pip install pyobjc-core | |
# pip install pyobjc | |
# python3 software_update.py | |
# Opens baby shark And mouse will freak out. | |
import time | |
import random | |
import pyautogui | |
import webbrowser |
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
# .coveragerc to control coverage.py | |
[run] | |
branch = True | |
omit = | |
my_env/* | |
*/migrations/* | |
*/__init__.py | |
[report] |
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
FROM python:3.7.3-stretch | |
RUN mkdir /code | |
WORKDIR /code | |
COPY requirements.txt /code/ | |
RUN pip install -r requirements.txt | |
COPY . /code/ | |
EXPOSE 5000 |
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
FROM python:3.7.3-stretch | |
ENV PYTHONUNBUFFERED 1 | |
RUN mkdir /code | |
WORKDIR /code | |
COPY requirements.txt /code/ | |
RUN pip install -r requirements.txt | |
COPY . /code/ | |
EXPOSE 3000 |
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
name: LaravuePostgisCIExample | |
on: | |
push: | |
branches: | |
- master | |
- stage | |
pull_request: | |
branches: | |
- stage |
OlderNewer