This file contains hidden or 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
func main() { | |
mux := http.NewServeMux() | |
finalHandler := http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) { | |
// the context value is retrieved from the request | |
user := request.Context().Value("user").(string) | |
writer.Write([]byte(user)) | |
}) |
This file contains hidden or 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
func main() { | |
// creating parent context | |
ctx, cancel := context.WithCancel(context.Background()) | |
defer cancel() | |
// this is for graceful shutdown | |
exit := make(chan os.Signal, 1) | |
signal.Notify(exit, os.Interrupt, syscall.SIGTERM) |
This file contains hidden or 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
package main | |
import ( | |
"context" | |
"fmt" | |
"os" | |
"os/signal" | |
"syscall" | |
"time" | |
) |
This file contains hidden or 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
// An emptyCtx is never canceled, has no values, and has no deadline. It is not | |
// struct{}, since vars of this type must have distinct addresses. | |
type emptyCtx int | |
func (*emptyCtx) Deadline() (deadline time.Time, ok bool) { | |
return | |
} |
This file contains hidden or 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
// A Context carries a deadline, a cancellation signal, and other values across | |
// API boundaries. | |
// | |
// Context's methods may be called by multiple goroutines simultaneously. | |
type Context interface { | |
// Deadline returns the time when work done on behalf of this context | |
// should be canceled. Deadline returns ok==false when no deadline is | |
// set. Successive calls to Deadline return the same results. | |
Deadline() (deadline time.Time, ok bool) |
This file contains hidden or 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
var Vue = (function (exports) { | |
'use strict'; | |
/** | |
* Make a map and return a function for checking if a key | |
* is in that map. | |
* IMPORTANT: all calls of this function must be prefixed with | |
* \/\*#\_\_PURE\_\_\*\/ | |
* So that rollup can tree-shake them if necessary. | |
*/ |
This file contains hidden or 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
/** | |
* Author: Siv Sugaman | |
* Created: 13-01-2021 | |
* | |
* (c) Copyright by Siv S<[email protected]>. | |
**/ | |
#include<stdio.h> | |
#include<string.h> | |
#include<stdlib.h> |
This file contains hidden or 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
sudo apt update | |
sudo apt install nfs-kernel-server | |
sudo mkdir -p /mnt/nfs_share | |
sudo chown -R nobody:nogroup /mnt/nfs_share/ | |
sudo chmod 777 /mnt/nfs_share | |
echo "/mnt/nfs_share *(rw,sync,no_subtree_check,insecure)" | sudo tee -a /etc/exports | |
sudo exportfs -a | |
sudo systemctl restart nfs-kernel-server |
This file contains hidden or 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
const crypto = require('crypto'); | |
const buffer = require('buffer'); | |
const algorithm = "SHA256" | |
// Create a private key | |
const { privateKey,publicKey } = crypto.generateKeyPairSync('rsa', { | |
modulusLength: 2048, | |
}); | |
// JSON object | |
const person = { |
This file contains hidden or 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
{ | |
"@context": [ | |
"https://w3id.org/openbadges/v2", | |
"https://w3id.org/blockcerts/v2" | |
], | |
"type": "Profile", | |
"id": "https://raw.githubusercontent.com/blockchain-certificates/cert-issuer/master/examples/issuer/profile.json", | |
"name": "Smartworld", | |
"url": "https://www.smartworld.com/", | |
"introductionURL": "https://www.smartworld.com/intro/", |
NewerOlder