Skip to content

Instantly share code, notes, and snippets.

View keqiang's full-sized avatar

Keqiang Li keqiang

View GitHub Profile
@keqiang
keqiang / install-k8s-arch.md
Last active August 17, 2023 12:24 — forked from StephenSorriaux/install-kubernetes-archlinux.md
Install Kubernetes on Bare-metal Arch Linux Using kubeadm

Install Kubernetes on Bare-metal Arch Linux Using kubeadm

You can use root to perform following steps until a regular user is indicated

Install Packages that K8s(actually kubeadm) requires

If one of these packages are not presented, kubeadm will report warnings or errors

pacman -S docker ebtables ethtool socat
@keqiang
keqiang / res-cookies.md
Last active July 30, 2019 19:15
Node Express Set Cookies for Response
// add middleware to your endpoint
app.use((req, res, next) => {
  const cookieOptions = {
    domain: 'localhost',
    maxAge: 1000 * 60 * 20, // valid for 20 minutes
    httpOnly: false // important if you want to access this cookie using Javascript
  };

 res.cookie('TEST-COOKIE', 'cookie-value', cookieOptions);

I have a mongodb instance running at localhost:27017

Then I imported the below grades.json into mongo database 'backend' by mongoimport --db backend --collection grades --drop --file ./grades.json

Next I created a feathers application called 'backend' by feathers generate app

Then created a service called 'grades', configured as 'mongoDB' and set the db link to 'localhost:27017/backend' by feathers generate service

@keqiang
keqiang / igv.min.js
Created April 10, 2018 14:01
IGV Upload File
!function(root,factory){"function"==typeof define&&define.amd?define([],factory):"object"==typeof module&&module.exports?module.exports=factory():root.igv=factory()}(this,function(){function ZStream(){}function Inflate(){this.was=[0]}function InfBlocks(z,checkfn,w){this.hufts=new Int32Array(3*MANY),this.window=new Uint8Array(w),this.end=w,this.checkfn=checkfn,this.mode=IB_TYPE,this.reset(z,null),this.left=0,this.table=0,this.index=0,this.blens=null,this.bb=new Int32Array(1),this.tb=new Int32Array(1),this.codes=new InfCodes,this.last=0,this.bitk=0,this.bitb=0,this.read=0,this.write=0,this.check=0,this.inftree=new InfTree}function InfCodes(){}function InfTree(){}function inflate_trees_fixed(bl,bd,tl,td,z){return bl[0]=fixed_bl,bd[0]=fixed_bd,tl[0]=fixed_tl,td[0]=fixed_td,Z_OK}function arrayCopy(src,srcOffset,dest,destOffset,count){if(0!=count){if(!src)throw"Undef src";if(!dest)throw"Undef dest";0==srcOffset&&count==src.length?arrayCopy_fast(src,dest,destOffset):hasSubarray?arrayCopy_fast(src.subarray(srcOffset,
@keqiang
keqiang / david_web_in_shiny.R
Last active April 12, 2018 21:18
Using 'RDAVIDWebService' Package in A Shiny App
library(shiny)
library(RDAVIDWebService)
# To install 'RDAVIDWebService' package
# source("https://bioconductor.org/biocLite.R") #
# biocLite("RDAVIDWebService")
ui <- fluidPage(fluidRow(
sliderInput(
"clusterNumber",
@keqiang
keqiang / file_import_in_shiny.R
Last active February 15, 2018 03:04
Example of using 'shinywidgets' package to import data to R Shiny app
library(shiny)
library(shinywidgets) # install by devtools::install_github("keqiang/shinywidgets")
ui <- fluidPage(
wellPanel(
dataTableImportWidget("tableImport1"),
verbatimTextOutput("debug")
)
)
@keqiang
keqiang / server.R
Last active June 26, 2017 19:44 — forked from withr/server.R
Encrypt password with md5 for Shiny-app.
library(shiny)
library(datasets)
# user info database
# "098f6bcd4621d373cade4e832627b4f6" is the md5 value of string "test",
# so you need to type test for the password of user "auser"
users <-
data.frame(username = "auser", password = "098f6bcd4621d373cade4e832627b4f6")
shinyServer(function(input, output) {
@keqiang
keqiang / fileImportModule.R
Created May 15, 2017 19:43
A general R Shiny module to import Comma or Tab Separated Files
fileImportUI <- function(id, label = "Comma or Tab Separated File") {
ns <- NS(id)
tagList(
# browse to select file to import
fileInput(ns("selectedFile"), label, accept = c(
"text/csv",
"text/comma-separated-values",
"text/plain",
".csv",