Skip to content

Instantly share code, notes, and snippets.

version: "3"
networks:
loki:
services:
grafana:
image: grafana/grafana:7.2.0
ports:
@huikang
huikang / perplexity.py
Created October 23, 2019 16:43
calculate perplexity
import math
import torch
from transformers import BertTokenizer, BertModel, BertForMaskedLM, OpenAIGPTLMHeadModel, OpenAIGPTTokenizer
# Load pre-trained model (weights)
model = OpenAIGPTLMHeadModel.from_pretrained('openai-gpt')
model.eval()
# Load pre-trained model tokenizer (vocabulary)
tokenizer = OpenAIGPTTokenizer.from_pretrained('openai-gpt')
@huikang
huikang / jwks.json
Last active January 15, 2019 20:42
jwks
{ "keys":[{"e": "AQAB", "kty": "RSA", "n": "tbLV6yge386z4xvlRAuX76_Uj1Ef_98JQSIFN0CqqzwF4KT_4o1jsdaPNp-kJdkPaOkBHe7n9faIXuT-gN4SiWQodh2y0xsj31luJF0WnLjmdkDcDRSm_d1TcnAst8DA_0MkhRKBYcXA9YEpAveaaPOq9O-0wyPsccuIsxMez9ix4NjkIEds8q6VvWYOnUfF-vxbi_aVXRN7JRV8k8XV0ipcaLO5oNnENMzQKAkyhuUw3HkRChbtW5uD7StyIn58J6o6ux2aNJwjtga1ZnQ703YLci20ahRex2T33IgmrxJNORGFy_MJd-Nxm3IoXCLwEBoOou0HjQ0dX8V45kLbPw"}]}
@huikang
huikang / sendemail.js
Last active March 12, 2018 19:23
wsk-send-email
var request = require('request-promise');
/**
* Triggered whenever data changes in the database
*
* @param params.id The id of the record in the Cloudant 'service' database, if invoked by a database change
* @param params.appliance The appliance object if invoked by the nightly alarm trigger
* @param params.SENDGRID_API_KEY SendGrid key for sending notifications
* @param params.SENDGRID_FROM_ADDRESS Address to set as sender
* @param params.SENDGRID_TO_ADDRESS Address to set as receiver
@huikang
huikang / custom.js
Created January 21, 2018 03:38 — forked from garbados/custom.js
Sample CouchDB map functions for working with dates without a library.
function(doc){
// handle a custom format using methods in the date object
var format = "{getFullYear}/{getMonth}/{getDate}",
date = new Date(doc.created_at),
// use a regular expression to replace parts of our format string
formatted_date = format.replace(/\{(\w+)\}/g, function(str, func){
var time = date[func]();
// if `func` is `getMonth` we must offset by one
if(func === 'getMonth'){
time += 1;
/root/rumprun/./rumprun/rumprun-x86_64/lib/rumprun-hw/librumpdev_virtio_if_vioif.a(if_vioif.o):(.data+0x60): multiple definition of `rumpns_vioif_cd'
/root/rumprun/./rumprun/rumprun-x86_64/lib/rumprun-hw/librumpdev_virtio_if_vioif.a(component_simple.o):(.data+0x80): first defined here
/root/rumprun/./rumprun/rumprun-x86_64/lib/rumprun-hw/librumpdev_virtio_ld.a(ld.o):(.data+0x0): multiple definition of `rumpns_ld_cd'
/root/rumprun/./rumprun/rumprun-x86_64/lib/rumprun-hw/librumpdev_virtio_ld.a(ld_at_virtio.o):(.data+0xa0): first defined here
/root/rumprun/./rumprun/rumprun-x86_64/lib/rumprun-hw/librumpdev_pci_virtio.a(virtio_component.o):(.data+0xa0): multiple definition of `rumpns_virtio_cd'
/root/rumprun/./rumprun/rumprun-x86_64/lib/rumprun-hw/librumpdev_pci_virtio.a(component_simple.o):(.data+0xa0): first defined here
/root/rumprun/./rumprun/rumprun-x86_64/lib/rumprun-hw/librumpdev_pci_virtio.a(virtio.o):(.data+0x80): multiple definition of `rumpns_virtio_cd'
/root/rumprun/./rumprun/rumprun-x86_64/lib/rumpru
@huikang
huikang / rump_wmd -lrumpfs_ffs
Last active December 18, 2016 23:00
./rump/bin/rump_wmd -vv -L./rump/lib -lrumpfs_ffs 2>&1 | tee out
+ : cc
+ DEBUGLEVEL=0
+ LIBDIR=/usr/lib
+ unset FIRSTLIB
+ getopts hl:L:v opt
+ case "${opt}" in
+ '[' -z '' ']'
+ DEBUGLEVEL=1
+ getopts hl:L:v opt
+ case "${opt}" in