Skip to content

Instantly share code, notes, and snippets.

@devpilot
devpilot / keycloak-theme.yaml
Created May 3, 2024 07:47
deploy keycloak for theme development
apiVersion: v1
kind: Namespace
metadata:
labels:
kubernetes.io/metadata.name: keycloak-test
name: keycloak-test
spec:
finalizers:
- kubernetes
status:
@devpilot
devpilot / kube-setup.sh
Last active May 3, 2024 06:44
setup kubernetes single node cluster
#!/bin/sh
# curl -o- https://gist.githubusercontent.com/devpilot/6d0eb3eb5bc24bd19016ee62f7ba989d/raw/kube-setup.sh | sudo bash
#
# Make script executable
# chmod +x kube-setup.sh
#
# Run sctipt as root
# sudo ./kube-setup.sh
@devpilot
devpilot / flask-dl-demo.py
Created December 14, 2021 04:28
Demo api for zip download
from flask import Flask, send_file, make_response
import zipfile
import io
import pathlib
app = Flask(__name__)
@app.route("/download",methods=['GET'])
def request_zip():
base_path = pathlib.Path('./data/')
@devpilot
devpilot / init.sh
Created November 17, 2021 10:01
find and replace from build files
#!/bin/bash
buildFiles="build/static/js/*.chunk.js"
confFile="$(pwd)/client.conf"
while read -r line;do
key=$(echo "$line" | cut -d = -f 1)
value=$(echo "$line" | cut -d = -f 2)
sed -i "s|$key|$value|g" $buildFiles
done < $confFile
@devpilot
devpilot / .tmux.conf
Last active September 1, 2022 07:04
tmux configuration file
# Start numbering at 1
set -g base-index 1
# Display message longer
set-option -g display-time 1500
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
@devpilot
devpilot / prepare-commit-msg.js
Last active March 10, 2022 08:24
project standard format for Pivotal
#!/usr/bin/env node
/**
* Format commit message as required by Pivotal hook
* export PIVTOKEN="<your token>"
* write you commit message with story id anywhere, preferred at the beginning or end of message
* commit message will formats into
* [Delivers #<story ID>] <Story title>\n <commit message>
*/
@devpilot
devpilot / extract-date.php
Created May 10, 2017 12:24
extract date from js date
<?php
$jstime = "Mon Mar 20 2017 11:30:05 GMT+0530 (India Standard Time)";
$t = substr( $jstime, 0, strpos($jstime, '(') );
echo date( 'Y-m-d', strtotime($t) );
?>
@devpilot
devpilot / Sublime Text 3 Build 3103 License Key - CRACK
Created May 6, 2017 08:30
Sublime Text 3 Build 3103 License Key - CRACK
I use the first
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
@devpilot
devpilot / bc_exchange.php
Last active April 21, 2017 07:25
Fetch btc exchange rate
<?php
/**
* @package bc_exchange
* @version 1.2
*/
/*
Plugin Name: BC Exchange
Plugin URI: https://github.com/devpilot/
Description: Get BTC Exchange rate from <a href="https://blockchain.info/">Blockchain</a>
Author: DevPilot
@devpilot
devpilot / product_qty_bought.php
Last active March 1, 2017 00:11
Woocommerce - count specific product quantity bought by customer in all orders
<?php
/**
* Woocommerce - count specific product quantity bought by customer in all orders
*
* @param (int) $product_id
* @return int|bool
* @author devpilot
**/
function product_qty_bought($product_id){