Skip to content

Instantly share code, notes, and snippets.

View revant's full-sized avatar

Revant Nandgaonkar revant

View GitHub Profile
@revant
revant / FrappeApi.java
Created July 11, 2017 14:09
Sample Scribe OAuth2 for Frappe Server
package com.mntechnique.oauth2authenticator.utils;
import com.github.scribejava.core.builder.api.DefaultApi20;
import com.github.scribejava.core.exceptions.OAuthException;
import com.github.scribejava.core.extractors.TokenExtractor;
import com.github.scribejava.core.model.OAuth2AccessToken;
import com.github.scribejava.core.model.Response;
import com.github.scribejava.core.model.Verb;
import org.json.JSONException;
import org.json.JSONObject;
@revant
revant / envsetup.sh
Last active April 29, 2018 18:07
Environment Setup for building Lineage OS
source ~/android/venv/bin/activate
export LC_TIME=C
export LC_ALL=C
export ANDROID_JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx5G"
export USE_CCACHE=1
export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4096m"
export _JAVA_OPTIONS="-Xmx5g"
@revant
revant / manning_defconfig
Created May 20, 2018 14:41
stock_manning_oreo_defconfig
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm64 3.18.60 Kernel Configuration
#
CONFIG_ARM64=y
CONFIG_64BIT=y
CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
CONFIG_MMU=y
CONFIG_ARCH_MMAP_RND_BITS_MIN=18
CONFIG_ARCH_MMAP_RND_BITS_MAX=24
@revant
revant / pacman.conf
Created November 13, 2019 00:07
Arch Linux PC
#
# /etc/pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives
#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
# Install these packages (use your favorite AUR tool here)
yay -Syu minikube-bin kubectl docker-machine-driver-kvm2 libvirt qemu-headless docker-machine ebtables
# Get libvirt going
sudo systemctl enable libvirtd.service
sudo usermod -a -G libvirt $(whoami)
# This fix thanks to http://blog.programmableproduction.com/2018/03/08/Archlinux-Setup-Minikube-using-KVM/
sudo virsh net-autostart default
@revant
revant / ganache-cli.docker-compose.yml
Last active March 1, 2021 15:24
ganache-cli docker stack
version: "3.7"
services:
ganache:
image: trufflesuite/ganache-cli:latest
command: -h 0.0.0.0 -p 7545 --db /data
volumes:
- ganache-vol:/data
networks:
- ganache-network
@revant
revant / id-token.guard.ts
Created January 30, 2021 14:32
IdTokenGuard NestJS Guard to verify IdToken using JWKS
import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common';
import { GqlExecutionContext } from '@nestjs/graphql';
import * as jwt from 'jsonwebtoken';
import * as jwksClient from 'jwks-rsa';
@Injectable()
export class IdTokenGuard implements CanActivate {
canActivate(context: ExecutionContext) {
const ctx = GqlExecutionContext.create(context);
const req = ctx.getContext().req;
[Unit]
Description="frappe-bench-frappe-default-worker"
PartOf=frappe-bench-workers.target
[Service]
User=revant
Group=revant
Restart=always
ExecStart=/home/revant/.local/bin/bench worker --queue default
StandardOutput=file:/home/revant/frappe-bench/logs/worker.log
@revant
revant / mongodb.yml
Created March 25, 2021 09:26
Backing Services for development
version: '3'
services:
db:
image: bitnami/mongodb:latest
restart: always
environment:
- MONGODB_USERNAME=app-data
- MONGODB_PASSWORD=admin
- MONGODB_DATABASE=app-data
@revant
revant / k3d-cluster.md
Last active December 5, 2021 08:46
Commands to install k8s cluster using k3d for local use
  1. Install devcluster, publish ports without traefik.
k3d cluster create devcluster \
  --api-port 127.0.0.1:6443 \
  -p 80:80@loadbalancer \
  -p 443:443@loadbalancer \
  --k3s-arg "--disable=traefik@server:0"