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
filetype off | |
set number | |
set relativenumber | |
set noswapfile | |
set title | |
set cursorline | |
set encoding=UTF-8 | |
let mapleader = "," |
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 ALGORITHM_NAME = 'aes-256-cbc' | |
const ENCRYPT_KEY = 'e916e810f3858bffc8751581ca81a748' | |
const IV_LENGTH = 16 | |
const NONCE_LENGTH = 4 | |
const encryptString = (plainText) => { | |
const nonce = crypto.randomBytes(NONCE_LENGTH) | |
const iv = crypto.randomBytes(IV_LENGTH) | |
const cipher = crypto.createCipheriv(ALGORITHM_NAME, ENCRYPT_KEY, iv) |
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 ( | |
"crypto/ecdsa" | |
"crypto/rand" | |
"crypto/sha256" | |
"crypto/x509" | |
"encoding/asn1" | |
"encoding/base64" | |
"encoding/pem" |
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 { privateKey, publicKey } = crypto.generateKeyPairSync('ec', { | |
namedCurve: 'prime256v1', | |
publicKeyEncoding: { | |
type: 'spki', | |
format: 'pem' | |
}, | |
privateKeyEncoding: { | |
type: 'pkcs8', | |
format: 'pem' |
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 ( | |
"crypto/ecdsa" | |
"crypto/elliptic" | |
"crypto/rand" | |
"crypto/x509" | |
"encoding/pem" | |
"fmt" | |
) |
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 ( | |
"fmt" | |
"log" | |
"net/http" | |
"github.com/urfave/negroni" | |
"github.com/gorilla/mux" |
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
Show hidden characters
{ | |
"extends": "google", | |
"parser": "babel-eslint", | |
"env": { | |
"es6": true, | |
"node": true | |
}, | |
"rules": { | |
"semi":["error", "never"], | |
"quotes": ["error", "double"], |
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
// need to use babel | |
// npm install babel-cli | |
// babel-node file.js | |
const a = (x) => { | |
return new Promise(resolve => { | |
setTimeout(() => { | |
resolve(x) | |
}, 3000) | |
}) |