Skip to content

Instantly share code, notes, and snippets.

View j0lvera's full-sized avatar
🎯
Focusing

Juan Olvera j0lvera

🎯
Focusing
View GitHub Profile
/*!
* quantize.js Copyright 2008 Nick Rabinowitz.
* Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
*/
// fill out a couple protovis dependencies
/*!
* Block below copied from Protovis: http://mbostock.github.com/protovis/
* Copyright 2010 Stanford Visualization Group
* Licensed under the BSD License: http://www.opensource.org/licenses/bsd-license.php
@j0lvera
j0lvera / social-colors.css
Last active September 28, 2022 23:05
social-colors.css
.fa-facebook-square { color: #3b5998; }
.fa-twitter-square { color: #55acee; }
.fa-google-plus-square { color: #dd4b39; }
.fa-linkedin-square { color: #0976b4; }
.fa-pinterest-square { color: #cc2127; }
.fa-youtube-square { color: #b31217; }
.fa-instagram { color: #3f729b; }
@j0lvera
j0lvera / decorator.py
Last active June 1, 2021 20:33
bottle.py basic auth examples
from bottle import route, run, auth_basic
from passlib.hash import sha256_crypt
def check_pass(username, password):
hashed = ''.join(redis.hmget(username, "password"))
return sha256_crypt.verify(password, hashed)
@route('/', method='GET')
@auth_basic(check_pass) # <-- decorator
def index():
@j0lvera
j0lvera / Readme.md
Created October 12, 2019 20:19 — forked from colllin/Readme.md
FaunaDB User Token Expiration (for ABAC)

Auth0 + FaunaDB ABAC integration: How to expire Fauna user secrets.

Fauna doesn't yet provide expiration/TTL for ABAC tokens, so we need to implement it ourselves.

What's in the box?

3 javascript functions, each of which can be imported into your project or run from the command-line using node path/to/script.js arg1 arg2 ... argN:

  1. deploy-schema.js: a javascript function for creating supporting collections and indexes in your Fauna database.
@j0lvera
j0lvera / pwg.js
Created March 2, 2014 19:46
pwg.js a strong password generator
function pwg(length, option) {
var pw = "",
arr = [],
isOpera = false,
chars = [
"abcdefghijklmnopqrstuvwxyz",
"1234567890",
"!@#$%&*()_+}{:?-=}[;/.,]",
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
],
@j0lvera
j0lvera / social-options-wp.md
Last active October 15, 2017 15:04
How to add social icons using Option Tree and Font Awesome in WordPress

in header.php

<?php
  if ( function_exists( 'ot_get_option' ) ) {
    $social_media_channels = array(
      "Facebook" => "fa fa-facebook-square",
      "Twitter" => "fa fa-twitter-square",
      "Google+" => "fa fa-google-plus-square",
 "Linkedin" =&gt; "fa fa-linkedin-square",
@j0lvera
j0lvera / auth.py
Created April 6, 2014 06:42
auth.py
#!/usr/bin/env python
from bottle import route, run, template, static_file, request, parse_auth, auth_basic
from redis import StrictRedis as Redis
from cork import Cork
from hashids import Hashids
from passlib.hash import pbkdf2_sha256
incr1 = Hashids(salt="Eehu6laucelohh3b", min_length="16")
incr2 = Hashids(salt="Phiejapie2ahr9wa", min_length="8")
@j0lvera
j0lvera / pylintrc
Created July 25, 2017 19:28
pylintrc
[MASTER]
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code
extension-pkg-whitelist=
# Add files or directories to the blacklist. They should be base names, not
# paths.
ignore=CVS
@j0lvera
j0lvera / search_index.json
Last active July 6, 2017 06:00
WHATWG Search index in Python
[{"text": "Introduction", "section": "1", "uri": "introduction.html#introduction"}, {"text": "Is this HTML5?", "section": "1.1 - Introduction", "uri": "introduction.html#is-this-html5?"}, {"text": "Background", "section": "1.2 - Introduction", "uri": "introduction.html#background"}, {"text": "Audience", "section": "1.3 - Introduction", "uri": "introduction.html#audience"}, {"text": "Scope", "section": "1.4 - Introduction", "uri": "introduction.html#scope"}, {"text": "History", "section": "1.5 - Introduction", "uri": "introduction.html#history-2"}, {"text": "Design notes", "section": "1.6 - Introduction", "uri": "introduction.html#design-notes"}, {"text": "Compliance with other specifications", "section": "1.6.1 - Design notes", "uri": "introduction.html#compliance-with-other-specifications"}, {"text": "Extensibility", "section": "1.6.2 - Design notes", "uri": "introduction.html#extensibility"}, {"text": "HTML vs XML syntax", "section": "1.7 - Introduction", "uri": "introduction.html#html-vs-xhtml"}, {"text":