Skip to content

Instantly share code, notes, and snippets.

@yuanotes
yuanotes / browser.js
Last active December 22, 2017 08:03
Detect browser with UA in China
const ua = navigator.userAgent.toLowerCase();
export function isWechat() {
return /micromessenger/i.test(ua);
}
export function isAndroid() {
return /android/i.test(ua);
}
@yuanotes
yuanotes / blockchain.py
Created January 17, 2018 15:43
A simple blockchain implemented with python.
# -*- coding: utf-8 -*-
"""
A simple blockchain.
"""
import sys
import requests
import hashlib
import json
from urllib.parse import urlparse
from time import time
@yuanotes
yuanotes / gist:2bcd7bcc7a30e51a7ce5e956766be8b3
Created February 14, 2019 08:43
blockstack id verification
Verifying my Blockstack ID is secured with the address 1LBRU2Pu2jQfXqVELfP3VyfunRDXDZoydb https://explorer.blockstack.org/address/1LBRU2Pu2jQfXqVELfP3VyfunRDXDZoydb
@yuanotes
yuanotes / godot_reload_debugger.js
Created October 20, 2020 16:35
This script enabls godot client listen to file modifications by external editors
const net = require('net');
const fs = require('fs');
const reloadCMD = "\x20\x00\x00\x00\x13\x00\x00\x00\x01\x00\x00\x00\x04\x00\x00\x00\x0e\x00\x00\x00reload_scripts\x00\x00"
// start godot client at first /Applications/Godot.app/Contents/MacOS/Godot -d --remote-debug 127.0.0.1:8008
const port = 8008;
const server = net.createServer();