Skip to content

Instantly share code, notes, and snippets.

View Trshant's full-sized avatar
🤠
docker/kubernetes/

Trshant Trshant

🤠
docker/kubernetes/
View GitHub Profile
@Trshant
Trshant / minimal_webserver.py
Created November 8, 2019 02:53
a minimal webserver in python 3
# from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer # python2
from http.server import BaseHTTPRequestHandler, HTTPServer # python3
class HandleRequests(BaseHTTPRequestHandler):
def _set_headers(self):
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
def do_GET(self):
@Trshant
Trshant / setup.sh
Last active October 7, 2020 04:11
This gist is for anyone who wishes to have a jumping start into [fast.ai's NLP course](https://www.fast.ai/2019/07/08/fastai-nlp/).
mkdir learnnlp && cd learnnlp
git clone https://github.com/fastai/course-nlp course
sudo docker run -p 8888:8888 -v "$(pwd)"/course:/home/jovyan/work jupyter/scipy-notebook
@Trshant
Trshant / fetches.js
Created November 16, 2020 13:23
use fetch for CRUD using mockapi
// CREATE add data
const data = {
"name":"Trff vgtt",
"email": "[email protected]",
"phno": 2134445
};
fetch('https://<app_id>.mockapi.io/v1/users', {
method: 'POST',
headers: {
# creating a secret key using random
import os
os.urandom(24)
# '\x17\x96e\x94]\xa0\xb8\x1e\x8b\xee\xdd\xe9\x91^\x9c\xda\x94\t\xe8S\xa1Oe_'
os.urandom(24).encode('hex')
# 'cd48e1c22de0961d5d1bfb14f8a66e006cfb1cfbf3f0c0f3'
@Trshant
Trshant / prompt.sh
Created September 1, 2023 19:39
This is something else i have made to make bash scripting easier. This is a library that one can import to use in making colored prompts. Colors in the terminal are easy once you know how, but i just thought it might be a good idea to have a library just in case!
function prompt/color(){
local RED="\e[31m"
local GREEN="\e[32m"
local YELLOW="\e[33m"
local BLUE="\e[34m"
local INPUTCOLOR=$1
eval "COLOR="\${$INPUTCOLOR}
local TEXT=$2
local ENDCOLOR="\e[0m"