Skip to content

Instantly share code, notes, and snippets.

@yangyi
yangyi / README.md
Created March 31, 2020 01:30 — forked from bvis/README.md
Docker Env Vars expanded with secrets content

Variables by Secrets

Sample script that allows you to define as environment variables the name of the docker secret that contains the secret value. It will be in charge of analyze all the environment variables searching for the placeholder to substitute the variable value by the secret.

Usage

You can define the next environment variables:

@yangyi
yangyi / devops_best_practices.md
Created November 22, 2018 02:02 — forked from jpswade/devops_best_practices.md
Devops Best Practices

DevOps started out as "Agile Systems Administration". In 2008, Andrew Shafer did a talk called "Agile Infrastucture" addressing issues around involving more of the company in the same disciplines as programmers.

In 2009, Patrick Debois created "DevOpsDays" conference to help to bring it to light. However, it wouldn't begin to trend until about 2010, when people would begin to describe it as a standalone discipline.

Today, DevOps goes beyond just developers, systems administration and infrastructure, its about [dev, ops, agile, cloud, open source and business](https://blogs.the451group.com/opensource/2010/03/03/devops-mixing-dev-ops-agile-cloud-open-source-and-busi

Insight-api使用的express框架对post请求有Body大小限制,默认为100kb,报错位置为:/bitcore/node_modules/raw-body/index.js, line196
发送的post为json格式,根据调用轨迹express的body-parser模块对json格式的大小限制:/bitcore/node_modules/body-parser/lib/types/json.js, line54
调用body-parser的是bitcore web service,现通过修改web service中的调用参数改为200kb:
bitcore/node_modules/bitcore-node/lib/services/web/index.js, line42
整理了bitcore客户端大致结构:
启动bitcored后,读取bitcore-node.json配置文件,启动其中的各项service。
通过log信息判断,p2p service会根据配置文件去连接一个指定的peer端口,此时如果已启动一个bitcoin node,p2p service就可以连接到这个node。如果配置文件没有指定端口,则会建立一个内置的bcoin node,bcoin是一个通过nodejs实现的bitcoin协议。
Bcoin启动代码位置:/bitcore/node_modules/bitcore-node/lib/services/p2p/bcoin.js, line11
@yangyi
yangyi / ballot.sol
Created July 27, 2018 09:58
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=true&gist=
pragma solidity ^0.4.13;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
@yangyi
yangyi / rmqdemo.kt
Created October 31, 2017 08:21
rabbitmq demo
import com.rabbitmq.client.AMQP
import com.rabbitmq.client.ConnectionFactory
import com.rabbitmq.client.DefaultConsumer
import com.rabbitmq.client.Envelope
import java.nio.charset.Charset
import java.util.*
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
fun main(args: Array<String>) {
@yangyi
yangyi / blockchain-replace-market.md
Last active August 7, 2017 07:28
区块链用市场代替网络

1/ Blockchains will replace networks with markets.

2/ Humans are the networked species. The first species to network across genetic boundaries and thus seize the world.

3/ Networks allow us to cooperate when we would otherwise go it alone. And networks allocate the fruits of our cooperation.

4/ Overlapping networks create and organize our society. Physical, digital, and mental roads connecting us all.

5/ Money is a network. Religion is a network. A corporation is a network. Roads are a network. Electricity is a network...

@yangyi
yangyi / just_a_quick_reminder_why_bitcoin_was_invented_in.md
Last active August 7, 2017 07:13
just_a_quick_reminder_why_bitcoin_was_invented_in

original posts

https://www.reddit.com/r/Bitcoin/comments/6rr6ph/just_a_quick_reminder_why_bitcoin_was_invented_in/

  • People used to pay each other in gold and silver. Difficult to transport. Difficult to divide.
  • Paper money was invented. A claim to gold in a bank vault. Easier to transport and divide.
  • Banks gave out more paper money than they had gold in the vault. They ran “fractional reserves”. A real money maker. But every now and then, banks collapsed because of runs on the bank.
  • Central banking was invented. Central banks would be lenders of last resort. Runs on the bank were thus mitigated by banks guaranteeing each other’s deposits through a central bank. The risk of a bank run was not lowered. Its frequency was diminished and its impact was increased. After all, banks remained basically insolvent in this fractional reserve scheme.
  • Banks would still get in trouble. But now, if one bank got in sufficient trouble, they would all be in trouble at the same time. Governments would have to step in
### Keybase proof
I hereby claim:
* I am yangyi on github.
* I am joeyang (https://keybase.io/joeyang) on keybase.
* I have a public key ASDhx69f03wZjHtPaNVizd_NAs4SVTq7tj0kScfkaPcd2Ao
To claim this, I am signing this object:
org.springframework.dao.InvalidDataAccessApiUsageException: The given id must not be null!; nested exception is java.lang.IllegalArgumentException: The given id must not be null!
at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:384) ~[spring-orm-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:246) ~[spring-orm-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:488) ~[spring-orm-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:59) ~[spring-tx-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213) ~[spring-tx-4.3.7.RELEASE.j
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-05-09 09:10:58.493 ERROR 4124 --- [ main] o.s.boot.SpringApplication : Application startup failed
java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:779) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:760) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:747) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]