Skip to content

Instantly share code, notes, and snippets.

View KShivendu's full-sized avatar
👨‍💻
Learning Cool Stuff

Kumar Shivendu KShivendu

👨‍💻
Learning Cool Stuff
View GitHub Profile
@KShivendu
KShivendu / kurl.sh
Last active April 21, 2024 08:56
kurl: Curl simplified
#!/bin/bash
# Simplified curl
function kurl() {
local delimiter=$'\x1E' # ASCII record separator
local response=$(curl -s "$@" -w "${delimiter}%{http_code}")
IFS="$delimiter" read -r body http_code <<< "$response"
export HTTP_CODE="$http_code"
echo $body
@KShivendu
KShivendu / jf.sh
Last active April 21, 2024 08:16
jf: TUI for exploring JSON data
# jq REPL (jq + fzf = jf)
function jf() {
if [ $# -eq 0 ]; then
# pipe input
tempfile=$(mktemp)
cat > "$tempfile"
echo '' | fzf --print-query --preview "jq {q} $tempfile"
rm "$tempfile"
else
# filename arg input
@KShivendu
KShivendu / setup.sh
Last active March 19, 2024 06:41
Bare minimum setup
#!/bin/bash
set -x
# Install important packages
sudo apt update
sudo apt install -y zsh fzf autojump tmux jq
# Change the default shell to zsh
# chsh -s $(which zsh)
@KShivendu
KShivendu / supertokens-socket.py
Created August 7, 2023 15:28
Example application to demonstrate usage of supertokens python SDK with flask socketio
from flask import Flask, render_template, request
from flask_socketio import SocketIO, emit
import json
from backend import config
from supertokens_python import init
from flask import jsonify, g
from supertokens_python.framework.flask import Middleware
from supertokens_python.recipe.session.syncio import get_session, get_session_without_request_response