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 / 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"
# 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 / fetches.js
Created November 16, 2020 13:23
use fetch for CRUD using mockapi
// CREATE add data
const data = {
"name":"Trff vgtt",
"email": "trs.bt@gmail.com",
"phno": 2134445
};
fetch('https://<app_id>.mockapi.io/v1/users', {
method: 'POST',
headers: {
@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 / 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):

Bare Basics

  1. https://developer.mozilla.org/en-US/docs/Learn/HTML : read this to re familiarize yourself with the basics of HTML and CSS. The examples are editable, so use that to your advantage.

Setting up a Dev Environment

  1. You will need to build a small webserver. But before that decide if you want to work on just JS or Python. The need for both is there so the decision is up to you. Once you decide, get a webserver up and working. This is just to get started on ediitng your page on your computer. Also, Going forward, we can get all these things up on Heroku ( free hosting ) for your portfolio.
  2. You now need to install a code editor ( Sublime Text or Visual Studio Code ) and start learning GIT. http://tom.preston-werner.com/2009/05/19/the-git-parable.html Read that to understand what GIT does, Then create a s
@Trshant
Trshant / Dockerfile
Last active October 4, 2019 06:54
React Scaffolding files
FROM node:12.10.0-alpine
RUN npm install -g create-react-app \
create-react-native-app \
react-native-cli
RUN mkdir /code
WORKDIR /code
ADD . /code
@Trshant
Trshant / tmux-cheatsheet.markdown
Created August 21, 2019 10:40 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@Trshant
Trshant / wa_benchmarking.html
Created May 19, 2019 12:07
WA benchmarking
<html>
<head>
<script>
let squarer;
function loadWebAssembly(fileName) {
return fetch(fileName)
.then(response => response.arrayBuffer())
.then(bits => WebAssembly.compile(bits))
@Trshant
Trshant / Dockerfile
Created April 24, 2019 16:19
docker setup for LAMP
FROM php:7.3-apache
LABEL maintainer="mail@trshant.dev"
# Install PHP extensions and PECL modules.
RUN buildDeps=" \
default-libmysqlclient-dev \
libbz2-dev \
libmemcached-dev \
libsasl2-dev \
" \