Skip to content

Instantly share code, notes, and snippets.

@Danielfenghk
Danielfenghk / logging-testing.sc
Created September 26, 2022 01:19 — forked from dacr/logging-testing.sc
Playing/testing with logback configuration. / published by https://github.com/dacr/code-examples-manager #b45b0038-e0fc-4dd5-810f-5ad9b420f41e/160f7f5e1ce02df1e29f81405c8d10a742acc219
// summary : Playing/testing with logback configuration.
// keywords : scala, scalatest, logs, logback, @testable
// publish : gist
// authors : David Crosson
// license : Apache2
// id : b45b0038-e0fc-4dd5-810f-5ad9b420f41e
// created-on : 2020-05-31T19:54:52Z
// managed-by : https://github.com/dacr/code-examples-manager
// run-with : scala-cli $file
import { tap, retryWhen } from 'rxjs/operators';
import { webSocket } from 'rxjs/webSocket';
import { timer } from 'rxjs';
const wsSubjectConfig = {
url: 'wss://www.gasnow.org/ws/gasprice',
// added this to the config object
closeObserver: {
// this is triggered when connection is closed
next(event) {
@Danielfenghk
Danielfenghk / .gitlab-ci.yml
Created August 23, 2022 07:55 — forked from olgac/.gitlab-ci.yml
GitLab .gitlab-ci.yml
stages:
- Setup
- Deploy
Permissions:
stage: Setup
image: alpine:3.11.2
tags:
- gitlab
script:
@Danielfenghk
Danielfenghk / AdbCommands
Created July 29, 2022 01:12 — forked from Pulimet/AdbCommands
Adb useful commands list
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader

【虛擬貨幣錢包】從 BIP32、BIP39、BIP44 到 Ethereum HD Wallet

錢包是很多人第一次接觸 Ethereum 或其他虛擬貨幣的地方。不管是用手機或瀏覽器的錢包,相信很多人都對一串陌生的單字感到好奇(而且很重要還要備份)。這是源自於 Bitcoin 中錢包的設計,採用這套機制的錢包通常稱為 HD Wallet本篇希望簡述 HD Wallet 的架構,再使用 JavaScript 套件從頭創建一個 Ethereum HD Wallet

虛擬貨幣錢包

錢包顧名思義是存放$$$。但在虛擬貨幣世界有點不一樣,我的帳戶資訊(像是我有多少錢)是儲存在區塊鏈上,實際存在錢包中的是我的帳戶對應的 key。有了這把 key 我就可以在虛擬貨幣世界證明我的身份、就可以更改我帳戶的狀態(像是送錢給別人)。這樣來說,虛擬貨幣錢包實際上是管理和儲存 key 的工具。這把 key 就是我的私鑰,而帳戶是從我的公鑰衍伸出來。

Ledger 虛擬貨幣錢包

@Danielfenghk
Danielfenghk / QualityCenter.py
Created December 11, 2019 10:02 — forked from zlorb/QualityCenter.py
QualityCenter - Python
import string
import sys
import os
from collections import Counter
import win32com.client
# Sample code for accessing QualityCenter
# 2014 (C) Zohar Lorberbaum
debug = False
@Danielfenghk
Danielfenghk / MSProject.py
Created December 11, 2019 10:01 — forked from zlorb/MSProject.py
MSProject - Python
import sys, time, datetime
from copy import copy, deepcopy
from collections import OrderedDict
import string
import math
import win32com.client
import traceback
# Sample code for accessing MSProject
# 2014 (C) Zohar Lorberbaum
@Danielfenghk
Danielfenghk / AutoHook.h
Created November 19, 2019 09:18 — forked from JohnCoates/AutoHook.h
Simple Objective-C Method Hooking
@protocol AutoHook <NSObject>
@required
+ (NSArray <NSString *> *)targetClasses;
@end
@Danielfenghk
Danielfenghk / mocha-guide-to-testing.js
Created June 5, 2018 02:12 — forked from samwize/mocha-guide-to-testing.js
Explain Mocha's testing framework - describe(), it() and before()/etc hooks
// # Mocha Guide to Testing
// Objective is to explain describe(), it(), and before()/etc hooks
// 1. `describe()` is merely for grouping, which you can nest as deep
// 2. `it()` is a test case
// 3. `before()`, `beforeEach()`, `after()`, `afterEach()` are hooks to run
// before/after first/each it() or describe().
//
// Which means, `before()` is run before first it()/describe()
require('chromedriver');
const webdriver = require('selenium-webdriver');
const By = webdriver.By;
describe('selenum test - part 2', () => {
it('should be able to start a website', async () => {
let driver = new webdriver.Builder()
.forBrowser('chrome')
.build();