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 / Procfile
Last active February 22, 2024 14:17
Use node server with frappe-bench
redis_cache: redis-server config/redis_cache.conf
redis_socketio: redis-server config/redis_socketio.conf
redis_queue: redis-server config/redis_queue.conf
web: bench serve --port 8000
socketio: /usr/bin/node apps/frappe/socketio.js
custom_app: /usr/bin/node apps/custom_app/custom_node.js
watch: bench watch
schedule: bench schedule
worker_short: bench worker --queue short
@revant
revant / nginx-files.conf
Last active February 12, 2024 10:36
Frappe CORS for nginx
location / {
rewrite ^(.+)/$ $1 permanent;
rewrite ^(.+)/index\.html$ $1 permanent;
rewrite ^(.+)\.html$ $1 permanent;
# Allow CORS for static files
add_header Access-Control-Allow-Origin $cors_origin;
add_header Access-Control-Allow-Methods "GET, OPTIONS";
location ~* ^/files/.*.(htm|html|svg|xml) {
[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 / 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 / .p10k.zsh
Last active February 5, 2022 06:41
Shell Environment Variables
# Generated by Powerlevel10k configuration wizard on 2019-11-13 at 05:50 IST.
# Based on romkatv/powerlevel10k/config/p10k-rainbow.zsh, checksum 41729.
# Wizard options: powerline, rainbow, time, vertical separators, sharp heads,
# flat tails, 2 lines, solid, no frame, darkest, sparse, concise.
# Type `p10k configure` to generate another config.
#
# Config for Powerlevel10k with powerline prompt style with colorful background.
# Type `p10k configure` to generate your own config based on it.
#
# Tip: Looking for a nice color? Here's a one-liner to print colormap.
@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 / github-webhook.guard.ts
Created October 20, 2019 10:47
NestJS GithubWebHookGuard
// 2019 Revant Nandgaonkar
// License: MIT
import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common';
import * as crypto from 'crypto';
import * as rawBody from 'raw-body';
@Injectable()
export class GithubWebHookGuard implements CanActivate {
async canActivate(context: ExecutionContext): Promise<boolean> {
@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