Skip to content

Instantly share code, notes, and snippets.

View baryon's full-sized avatar
💭
Founder of ChainBow

LI Long baryon

💭
Founder of ChainBow
View GitHub Profile
magic减肥法完整版
看到不少人,在减肥,为了避免出问题,还是贴个完整版。
这可是全球首发,目前周围有好多人实践过我的方法,有效率100%,成功率50%,没成功的原因是因为没有坚持到底,又长回去了。
此 方法主要参照阿特金斯法和永田孝行法。阿特金斯是低糖减肥的鼻祖,一直被人批斗,永田孝行是阿特金斯的改良版。
阿特金斯叫人一辈子不吃主食终生保持50克以内的糖类才能保持体重,永田孝行叫人一辈子吃粗粮才能保持体重。
本人研究结果,没有必要,而且他们对原理的解释我认为不完全正确。
@baryon
baryon / createScriptFromTx.js
Last active November 9, 2022 22:27
Create Bitcoin Script from any unlockTx or lockingTx
const bsv = require( 'bsv' )
const WhatsOnChain = require( 'whatsonchain' )
const _ = require( 'lodash' )
async function createScriptFromTx ( woc, prevTxid, outputIndex, scriptName, unlockParams = '', debugParams = '', txContext = {} ) {
//fetch transaction from prevTxid
const prevTxHex = await woc.getRawTxData( prevTxid )
const prevTx = new bsv.Transaction(prevTxHex)
@baryon
baryon / bigint.test.ts
Created January 31, 2024 06:16
Convert between bigint and buffer
import { expect, use } from 'chai'
import chaiAsPromised from 'chai-as-promised'
import { buffer2bigint, bigint2buffer } from '../src/bigint'
use(chaiAsPromised)
describe('Test Utils', () => {
before(async () => {
})
@baryon
baryon / testRegex.js
Created August 17, 2024 01:02 — forked from hanxiao/testRegex.js
Regex for chunking by using all semantic cues
// Updated: Aug. 15, 2024
// Run: node testRegex.js testText.txt
// Used in https://jina.ai/tokenizer
const fs = require('fs');
const util = require('util');
// Define variables for magic numbers
const MAX_HEADING_LENGTH = 7;
const MAX_HEADING_CONTENT_LENGTH = 200;
const MAX_HEADING_UNDERLINE_LENGTH = 200;