Skip to content

Instantly share code, notes, and snippets.

View shrawanx's full-sized avatar
🏠
Working from home

Shrawan P. shrawanx

🏠
Working from home
View GitHub Profile
@robsontenorio
robsontenorio / auth-refresh-token.js
Last active February 3, 2023 14:02
[OAUTH2][KEYCLOAK] Auto refresh token for @nuxtjs/auth module
const strategy = 'keycloak'
export default function ({ app }) {
const { $axios, $auth } = app
if (!$auth.loggedIn || !$auth.strategies[strategy])
return
const options = $auth.strategies.keycloak.options
@cobusc
cobusc / protected_media.md
Last active August 31, 2021 17:32
Protected Media in Django

Protected Media in Django

Introduction

Django manages media based on the following definitions:

BASE_DIR = /var/praekelt/telkom-spliceworks/
MEDIA_ROOT = "%s/media/" % BASE_DIR
require 'rubygems'
require 'anemone'
load 'global.rb' # contains the skip_links_like regex
# get all the html files that we need
Anemone.crawl("http://codex.wordpress.org/Function_Reference/") do |anemone|
anemone.skip_links_like $regex
anemone.on_pages_like /http\:\/\/codex.wordpress.org\/Function_Reference\// do |page|
puts page.url
matched = page.url.to_s.match /http\:\/\/codex.wordpress.org\/Function_Reference\/([_a-zA-Z0-9]+)$/