Skip to content

Instantly share code, notes, and snippets.

@hyperwang
hyperwang / luenu.py
Created February 12, 2018 06:04
luenu
import sys
import json
import time
from binascii import hexlify, unhexlify
from ethereum import utils
from ethereum.transactions import Transaction
import rlp
import codecs
from web3 import Web3, HTTPProvider
@hyperwang
hyperwang / 0_reuse_code.js
Created March 20, 2017 08:44
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@hyperwang
hyperwang / _service.md
Created April 28, 2016 09:17 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@hyperwang
hyperwang / default
Created April 21, 2016 04:16 — forked from mzsanford/default
Init script and defaults file for etcd on Ubuntu
# Set the pper listening address
# export ETCD_PEER_ADDR=127.0.0.1:7001
# Set other command line options like the name and discovery url
# from https://discovery.etcd.io/new
# export ETCD_OPTS="-name=name_here -discovery=https://discovery.etcd.io/token_here"
export ETCD_OPTS=""
@hyperwang
hyperwang / install_jenkins_plugins.sh
Last active January 12, 2016 03:28 — forked from basmussen/install_jenkins_plugins.sh
Install Jenkins plugins
#!/bin/bash
user='USER_NAME'
token='API_TOKEN_OF_USER'
host='http://'$user':'$token'@localhost:8080'
url=/pluginManager/installNecessaryPlugins
# git plugin https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin
curl -X POST -d '<jenkins><install plugin="git@2.0" /></jenkins>' --header 'Content-Type: text/xml' $host$url
# artifactory plugin https://wiki.jenkins-ci.org/display/JENKINS/Artifactory+Plugin
const UIManager = require('NativeModules').UIManager;
const handle = React.findNodeHandle(this.refs.myElement);
UIManager.measureLayoutRelativeToParent(
handle,
(e) => {console.error(e)},
(x, y, w, h) => {
console.log('offset', x, y, w, h);
});
@hyperwang
hyperwang / React Native: Get the size of screen
Created November 15, 2015 15:22
React Native: Get the size of screen
var Dimensions = require('Dimensions');
var SCREEN_WIDTH = Dimensions.get('window').width;
var SCREEN_HEIGHT = Dimensions.get('window').height;
@hyperwang
hyperwang / yosemite ntfs read+write.txt
Created October 18, 2015 06:15 — forked from bjorgvino/yosemite ntfs read+write.txt
osxfuse + ntfs-3g + Yosemite = NTFS R/W
Remove osxfuse if installed via homebrew:
> brew uninstall osxfuse
Install osxfuse binary and choose to install the MacFUSE compatibility layer:
http://sourceforge.net/projects/osxfuse/files/latest/download?source=files
Reboot (optional but recommended by osxfuse)
Install ntfs-3g via homebrew:
> brew update && brew install ntfs-3g
@hyperwang
hyperwang / CustomizedSorting.go
Last active August 29, 2015 14:12
Customized sorting function.
package main
import"sort"
import"fmt"
type ByLength[] string
func(sByLength)Len()int
{
returnlen(s)
augroup CursorLineOnlyInActiveWindow
autocmd!
autocmd VimEnter,WinEnter,BufWinEnter * setlocal cursorline
autocmd WinLeave * setlocal nocursorline
augroup END