Skip to content

Instantly share code, notes, and snippets.

@xxuejie
xxuejie / keybase.md
Created July 26, 2020 01:18
keybase.md

Keybase proof

I hereby claim:

  • I am xxuejie on github.
  • I am xxuejie (https://keybase.io/xxuejie) on keybase.
  • I have a public key ASCf7NvtlcagFeiSQMBOxRqIW0upR1S55Lg9we8VjMWGvgo

To claim this, I am signing this object:

$ cat << EOF > market_data.json
{
"coin_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"builder_pubkey_hash": "0x276f2fa3565a10c76164a5e92d4a0b699889ef48",
"lease_period": "0x64",
"overdue_period": "0x64",
"amount_per_period": "0x91494c600",
"lease_amounts": "0x12309ce54000"
}
EOF
@xxuejie
xxuejie / geometries.js
Last active March 17, 2020 13:50
Webruby code vs JavaScript code, both use three.js
// The original JS code for WebGL geometries example in three.js repository
// I only changed the order of the functions for better comparison
// with the Ruby version.
// You can still find the original version inline at http://mrdoob.github.com/three.js/examples/webgl_geometries.html
var container, stats;
var camera, scene, renderer;
if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
@xxuejie
xxuejie / build-gcc.md
Last active October 4, 2019 20:25 — forked from vlad-ivanov-name/build-gcc.md
build cross riscv32imac gcc with newlib

Set environment variables

export TARGET=riscv32-unknown-elf
export PREFIX=/work/public/$TARGET
export PATH=$PATH:$PREFIX/bin

Build binutils

@xxuejie
xxuejie / Dockerfile
Created August 17, 2017 03:25
Dockerfile for reproducing crystal build failure
FROM ubuntu:xenial
RUN apt-get update
RUN apt-get install \
libbsd-dev \
libedit-dev \
libevent-core-2.0-5 \
libevent-dev \
libevent-extra-2.0-5 \
libevent-openssl-2.0-5 \
@xxuejie
xxuejie / how-to-connect-an-iOS-device-to-your-computer-using-SOCKS.md
Last active February 10, 2017 20:32 — forked from austinhappel/how-to-connect-an-iOS-device-to-your-computer-using-SOCKS.md
How to connect an iOS device to your computer via a SOCKS proxy. Say you're running a virtual machine on your work computer. Say this machine, for whatever reason, can only connect to the internet over NAT - as in, it does not get it's own IP address. Say this VM is running a webserver, and you need a device outside of your computer to connect t…

How to connect an iOS device to your computer via a SOCKS proxy

Say you're running a virtual machine on your work computer. Say this machine, for whatever reason, can only connect to the internet over NAT - as in, it does not get it's own IP address. Say this VM is running a webserver, and you need a device outside of your computer to connect to it.

If only there was a way to get your work computer to 'share' it's network, so that you could get at that VM… Here's how you do it!

For all instructions, I assume your work computer is a mac

  1. Get your computer's IP address:
$ EMCC_FAST_COMPILER=1 ~/develop/opensource/webruby/modules/emscripten/emcc vatest.c
Warning: Variable __init_array_start not referenced
Warning: Variable __init_array_end not referenced
Warning: Variable __fini_array_start not referenced
Warning: Variable __fini_array_end not referenced
false && "Unsupported type"
/Users/rafael/develop/opensource/emscripten-fastcomp/lib/Target/JSBackend/JSBackend.cpp : 683
LLVM ERROR: fail
Traceback (most recent call last):
File "/Users/rafael/develop/opensource/webruby/modules/emscripten/emscripten.py", line 1347, in <module>
@xxuejie
xxuejie / command.sh
Created December 17, 2013 02:43
Compile and link hiredis with webruby
# Suppose the currenct directory is ~/develop
$ git clone https://github.com/redis/hiredis
$ cd hiredis
# Set emscripten compiling target
$ export EMCC_LLVM_TARGET=i386-pc-linux-gnu
# Locale the installation path of webruby, for example, on my mac this is:
# ~/.gem/ruby/2.0.0/gems/webruby-0.2.4/
@xxuejie
xxuejie / gist:6258440
Created August 17, 2013 19:52
workflow
$ git co CABLES-68-dev
(coding...)
$ git fetch
$ git rebase origin/CABLES-68
(fix merging...)
$ git co CABLES-68 && git rebase CABLES-68-dev
$ git push origin CABLES-68
@xxuejie
xxuejie / build.log
Created June 18, 2013 06:31
Build log of webruby using O2 mode
$ EMCC_LLVM_TARGET=i386-pc-linux-gnu EMCC_DEBUG=1 /Users/rafael/develop/webruby/modules/emscripten/emcc /Users/rafael/develop/webruby/build/mrbtest.bc -o /Users/rafael/develop/webruby/build/mrbtest.js -s TOTAL_MEMORY=33554432 --js-library /Users/rafael/develop/webruby/build/gem_test_library.js --pre-js /Users/rafael/develop/webruby/build/gem_test_append.js -s EXPORTED_FUNCTIONS="['_mruby_js_argument_type', '_mruby_js_convert_symbol_to_string', '_mruby_js_get_array_handle', '_mruby_js_get_float', '_mruby_js_get_hash_handle', '_mruby_js_get_integer', '_mruby_js_get_object_handle', '_mruby_js_get_proc', '_mruby_js_get_string_len', '_mruby_js_get_string_ptr', '_mruby_js_invoke_alloc_argv', '_mruby_js_invoke_fetch_argp', '_mruby_js_invoke_proc', '_mruby_js_invoke_release_argv', '_mruby_js_name_error', '_mruby_js_set_array_handle', '_mruby_js_set_boolean', '_mruby_js_set_float', '_mruby_js_set_function_handle', '_mruby_js_set_integer', '_mruby_js_set_nil', '_mruby_js_set_object_handle', '_mruby_js_set_string', '_ma