Skip to content

Instantly share code, notes, and snippets.

Avatar
🛸
Flying

Hongbo Miao Hongbo-Miao

🛸
Flying
View GitHub Profile
@Hongbo-Miao
Hongbo-Miao / min-char-rnn.py
Created May 4, 2021 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
View min-char-rnn.py
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
View graph_explainer.py
from math import sqrt
import torch
from tqdm import tqdm
import matplotlib.pyplot as plt
import networkx as nx
from torch_geometric.nn import MessagePassing
from torch_geometric.data import Data
from torch_geometric.utils import k_hop_subgraph, to_networkx
import numpy as np
@Hongbo-Miao
Hongbo-Miao / health.md
Last active Feb 18, 2021
Health Form
View health.md

Version 2/18/2021

The script is for IT employees who work in Shanghai office.

Feel free to contact me if you have any questions.

How to use the script?

Step 1

View canvas-as-favicon.html
<link rel="shortcut icon" width=32px>
<canvas style="display: none" id="loader" width="16" height="16"></canvas>
<script>
class Loader {
constructor(link, canvas) {
this.link = link;
this.canvas = canvas;
this.context = canvas.getContext('2d');
this.context.lineWidth = 2;
View opentelemetry.js
/* Front End */
import { CollectorTraceExporter } from '@opentelemetry/exporter-collector';
import { DocumentLoad } from '@opentelemetry/plugin-document-load';
import { XMLHttpRequestPlugin } from '@opentelemetry/plugin-xml-http-request';
import { BatchSpanProcessor, ConsoleSpanExporter } from '@opentelemetry/tracing';
import { WebTracerProvider } from '@opentelemetry/web';
const tracerProvider = new WebTracerProvider({
plugins: [new DocumentLoad(), new XMLHttpRequestPlugin()],
});
@Hongbo-Miao
Hongbo-Miao / index.md
Created Oct 4, 2020 — forked from bvaughn/index.md
How to use profiling in production mode for react-dom
View index.md
@Hongbo-Miao
Hongbo-Miao / nginx.conf
Created Sep 13, 2020 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
View nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@Hongbo-Miao
Hongbo-Miao / encryption.js
Created Sep 9, 2020 — forked from vlucas/encryption.js
Stronger Encryption and Decryption in Node.js
View encryption.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv);
View index.js
// 1. Server
// node index.js
//
// 2. Client
// 1) Start
// telnet localhost 3001
//
// 2) Quit
// Click Ctrl + ], then Ctrl + C
View press.one
https://press.one/p/v?s=a98d146efa2ee83dafcbef33da78eadae5b3c861e16fe4bc66344ea4bf4fbfb35c52bdb5b8f9c82f15a42cea9e68cc51a5602324503960bcf3152d824190175601&h=e317ecaf519eedbfbf39deda7515d970b93b3488549aa9d1157bfd43befe3ab2&a=83f94ab86a1749d7682b0087d4b81d73ef0f0103&f=P1&v=3