This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState, createContext, useContext } from 'react' | |
import './App.css' | |
const StateContext = createContext<any>(null) | |
function Form() { | |
const { state, setState } = useContext(StateContext) | |
const handleClick = () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Callable | |
import threading | |
import queue | |
class Promisse: | |
def __init__(self, q: queue.Queue): | |
self.q = q |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install linkerd cli | |
curl --proto '=https' --tlsv1.2 -sSfL https://run.linkerd.io/install | sh | |
export PATH=$PATH:~/.linkerd2/bin | |
# install linkerd | |
linkerd install --set proxyInit.runAsRoot=true | kubectl apply -f - | |
# enable dashboard | |
linkerd viz install | kubectl apply -f - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http { | |
server { | |
listen 80; | |
# Force reject to all other locations | |
location /api { | |
# Reject requests with unsupported HTTP method | |
if ($request_method !~ ^(GET|POST|HEAD|OPTIONS|PUT|DELETE)$) { | |
return 405; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Start a nodejs application in development or production | |
# depending on enviroment variable | |
if [ $NODE_ENV = "production" ] | |
then | |
echo "starting in production mode" | |
npm start | |
else | |
echo "starting in development mode" | |
npm run dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// read documentation of Axios at https://github.com/axios/axios | |
// <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script> - client-side | |
// | |
const axios = require('axios') | |
const Object = (function(){ | |
const endpoint = "/api/object" |