Skip to content

Instantly share code, notes, and snippets.

Avatar
💪
Keep chasing your dreams!

Duc Trung Mai maitrungduc1410

💪
Keep chasing your dreams!
View GitHub Profile
@degitgitagitya
degitgitagitya / .env
Last active May 23, 2023 20:18
Next JS + Next Auth + Keycloak + AutoRefreshToken
View .env
# KEYCLOAK BASE URL
KEYCLOAK_BASE_URL=
# KEYCLOAK CLIENT SECRET
KEYCLOAK_CLIENT_SECRET=
# KEYCLOAK CLIENT ID
KEYCLOAK_CLIENT_ID=
# BASE URL FOR NEXT AUTH
@d-demirci
d-demirci / keycloak.yml
Created September 15, 2020 18:29
keycloak tutor openedx plugin
View keycloak.yml
name: keycloak
version: 0.1.0
patches:
common-env-features: |
"ENABLE_THIRD_PARTY_AUTH": true
openedx-lms-common-settings: |
SOCIAL_AUTH_KEYCLOAK_KEY = 'educasual'
SOCIAL_AUTH_KEYCLOAK_SECRET = '7c81d36a-bec9-4833-931c-64baab674283'
SOCIAL_AUTH_KEYCLOAK_PUBLIC_KEY = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjyq0SjRVvMaoHDeB4AcyBmWNNLe36ibopb/8cgXwPIPtphX50MepMK5Xmne1euS6I8ZWPGJl3DNtK215AMUKoy87BSJX5o26RQx8d0M+WTvnw6EVLaskeJSiXu4WkYka2Ou+cc6mkyMMtDnkFybbjFFFdMOkDPSyCMEfakHH2b/es+6KBkIC+yqmigDy/S26rsVX5A7kFUP7QUGBPJqwOVQjyd9JaebQlxwN300NlWme2wZrypXOxWraPmpMsWlZVEtniqO+gtOT+ko41VQospwrsJSfSX05ch25WNIsDhOPNhfYOpdFDviHEiXMjtMm+XTLr0qfzVDdYEyJnmG7XwIDAQAB'
SOCIAL_AUTH_KEYCLOAK_AUTHORIZATION_URL = 'http://keycloak.nubidus.com/auth/realms/openedx/protocol/openid-connect/auth'
@wooooodward
wooooodward / axios.js
Created November 6, 2019 17:16
Axios plugin example with request interceptor that adds JWT token to the auth header and 401 response interceptor to refresh token
View axios.js
import Vue from 'vue'
import axios from 'axios'
import store from '../store'
import { TokenService } from '../services/storage.service'
// Full config: https://github.com/axios/axios#request-config
let config = {
baseURL:
process.env.baseURL ||
@nileshsimaria
nileshsimaria / docker-default-directory
Last active January 17, 2023 10:01
Change docker's default /var/lib/docker to different directory on Ubuntu
View docker-default-directory
1. Take a backup of docker.service file.
$ cp /lib/systemd/system/docker.service /lib/systemd/system/docker.service.orig
2. Modify /lib/systemd/system/docker.service to tell docker to use our own directory
instead of default /var/lib/docker. In this example, I am using /p/var/lib/docker
Apply below patch.
$ diff -uP -N /lib/systemd/system/docker.service.orig /lib/systemd/system/docker.service
--- /lib/systemd/system/docker.service.orig 2018-12-05 21:24:20.544852391 -0800
@giehlman
giehlman / updateSonarProps.sh
Created February 20, 2018 16:36
Update SonarQube properties file with project name and version from package.json
View updateSonarProps.sh
#!/usr/bin/env bash
#title : updateSonarProps.sh
#description :
# This script parses the project's name and version from its package.json and automagically
# updates the version and package name in the SonarQube configuration properties file.
# It can be used as a pre step before running the sonar-scanner command
# It also creates a backup of the props file with suffix *.bak
#prerequisites : NodeJS based project with package.json, sonar*.properties file in the cwd
#author : Christian-André Giehl <christian@emailbrief.de>
#date : 20180220
@virolea
virolea / upload.js
Last active May 24, 2023 00:56
Tracking file upload progress using axios
View upload.js
upload(files) {
const config = {
onUploadProgress: function(progressEvent) {
var percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total)
console.log(percentCompleted)
}
}
let data = new FormData()
data.append('file', files[0])
@xameeramir
xameeramir / default nginx configuration file
Last active May 24, 2023 23:34
The default nginx configuration file inside /etc/nginx/sites-available/default
View default nginx configuration file
# Author: Zameer Ansari
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
@mrbar42
mrbar42 / README.md
Last active May 6, 2023 13:32
bash scripts to create VOD HLS stream with ffmpeg almighty (tested on Linux and OS X)
View README.md

running:

bash create-vod-hls.sh beach.mkv

will produce:

    beach/
      |- playlist.m3u8
 |- 360p.m3u8
@aamishbaloch
aamishbaloch / remove_server_details.md
Last active April 28, 2020 22:18
Remove Server Details from Response Header - Nginx
View remove_server_details.md

Remove Server Details from Response Header - Nginx

Below mentioned method is used to hide or remove the NGIX details from the header of your http requests.

Install Nginx Extras

sudo apt-get update
sudo apt-get install nginx-extras

Remove Server Details

@antoviaque
antoviaque / gist:0b6cc931290881de546319cf673186f6
Last active June 16, 2022 15:58
Open edX - SSO Doc - Draft
View gist:0b6cc931290881de546319cf673186f6

Third Party Authentication Features in Open edX: Technical Knowledge Transfer

Part 1: Background / Notes

  • Open edX has full, integrated support for three different types of third party auth provider:
    1. OAuth based providers (OAuth2 and the older OAuth v1). Google, Facebook, LinkedIn, and Azure Active Directory are available by default. Any other OAuth backends supported by python-social-auth v0.2.12 can be enabled by changing a configuration setting. Contributed by Google (John Cox).
    2. SAML / Shibboleth. SAML is an SSO standard mostly used by universities and corporations. Shibboleth is the name of a particular implementation of SAML, commonly used by higher ed. institutions.
    3. LTI. Users can use Learning Tools Interoperability® (LTI®) to authenticate. Support for this was contributed by UBC.
  • The Open edX platform also includes limited support for the following SSO providers.
  1. [