Skip to content

Instantly share code, notes, and snippets.

View futurist's full-sized avatar

James Yang futurist

  • China
View GitHub Profile
@futurist
futurist / docker-compose.yml
Created March 22, 2021 07:11 — forked from undernewmanagement/docker-compose.yml
Pristine config for Traefik 2.0, Docker, and LetsEncrypt with sample container. Includes a HTTP to HTTPS redirect
version: '3'
services:
traefik:
container_name: traefik
image: traefik:v2.0
command:
- "--api.insecure=true"
- "--providers.docker=true"
@futurist
futurist / example.prf
Created December 18, 2020 15:12 — forked from mattes/example.prf
unison profile
root = /Users/matthias/somedir
root = ssh://matthias@host:9000/somedir
auto = true
log = true
logfile = /Users/matthias/.unison/unison.log
maxbackups = 5
backup = Name *
@futurist
futurist / GettingStartedTutorial1Commands.txt
Created December 3, 2020 02:31 — forked from bassem-mf/GettingStartedTutorial1Commands.txt
Getting Started With Graph Databases, Apache TinkerPop, and Gremlin - Tutorial 1
// Create an instance of the "Modern" toy graph
graph = TinkerFactory.createModern()
// Create the traversal source
g = graph.traversal()
// Get all vertices
@futurist
futurist / curl-websocket.sh
Created September 16, 2020 10:22 — forked from htp/curl-websocket.sh
Test a WebSocket using curl.
curl --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host: example.com:80" \
--header "Origin: http://example.com:80" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
http://example.com:80/

macOS:10.13.6 MacBook Pro (13-inch, Early 2011) TIME: 2020/08/10

rocket 110.44ms 4830.54

tide 72.26ms 6072.79

warp 51.66ms 7443.28

gotham 45.64ms 9502.72

@futurist
futurist / 从Node到Deno.md
Last active October 31, 2023 14:11
从Node到Deno

从Node到Deno,你需要知道的

* 第一部分:安装

以MacOS系统为例,说明安装的不同

A. Node安装

涉及的文件:node, npm, npx, node_modules 文件夹

rustup component add rust-src
export RUST_SRC_PATH="$(rustc --print sysroot)/lib/rustlib/src/rust/src"
@futurist
futurist / JSIObject.cpp
Created April 23, 2020 08:29 — forked from axemclion/JSIObject.cpp
React Native JSI Example
// This sample is a Work in Progress for JSI , and specific functions may change.
#pragma once
#include <string>
#include <unordered_map>
#include <jsi/jsi.h>
// This SameplJSIObject needs to inheric from HostObject, and this is the object that will be exposed to JS.
function arrayKV (obj, k, v, reverse, unique) {
let prevVal = _.get(obj, k)
if(!Array.isArray(prevVal)) {
prevVal = prevVal === undefined ? [] : [prevVal]
_.set(obj, k, prevVal)
}
if (unique && prevVal.indexOf(v) > -1) return
return reverse ? prevVal.unshift(v) : prevVal.push(v)
}