Skip to content

Instantly share code, notes, and snippets.

View qbig's full-sized avatar

Liang qbig

View GitHub Profile
@hoakbuilds
hoakbuilds / Solana
Created September 28, 2021 12:12
Solana dev resources
Guides / Walkthroughs
Intro to Programming on Solana
https://paulx.dev/blog/2021/01/14/programming-on-solana-an-introduction/
Development Tutorial by Solong
https://solongwallet.medium.com/solana-development-tutorial-things-you-should-know-before-structuring-your-code-807f0e2ee43
Intro to Anchor Framework
https://project-serum.github.io/anchor/getting-started/introduction.html
@onlurking
onlurking / programming-as-theory-building.md
Last active May 25, 2024 15:28
Programming as Theory Building - Peter Naur

Programming as Theory Building

Peter Naur

Peter Naur's classic 1985 essay "Programming as Theory Building" argues that a program is not its source code. A program is a shared mental construct (he uses the word theory) that lives in the minds of the people who work on it. If you lose the people, you lose the program. The code is merely a written representation of the program, and it's lossy, so you can't reconstruct

@sammarks
sammarks / lambda.js
Created May 7, 2020 00:04
Slack notifications from AWS Amplify
const https = require('https')
exports.handler = async (event) => {
const sns = event.Records[0].Sns.Message
let color = ''
let message = ''
if (sns.includes('build status is FAILED')) {
color = '#E52E59'
message = 'Release to My Company **production** failed.'
} else if (sns.includes('build status is SUCCEED')) {
@Auronmatrix
Auronmatrix / README.md
Last active June 26, 2019 07:50
DASH - Difficulty Drop (v0.13.3) after DIP8 Activation - Potential Network Segmentation

DASH Difficulty Drop Post Mortem & Potential Network Segmentation

Issue

Around 17.06.2019 our DASH node started showing some strange behaviour. When requesting blocks from the node, their reported difficulty was around ~50x lower than the actual network.

Average Daily Dash Difficulty

|Date | Difficulty|

@swyxio
swyxio / 1.md
Last active February 8, 2024 22:30
Learn In Public - 7 opinions for your tech career

2019 update: this essay has been updated on my personal site, together with a followup on how to get started

2020 update: I'm now writing a book with updated versions of all these essays and 35 other chapters!!!!

1. Learn in public

If there's a golden rule, it's this one, so I put it first. All the other rules are more or less elaborations of this rule #1.

You already know that you will never be done learning. But most people "learn in private", and lurk. They consume content without creating any themselves. Again, that's fine, but we're here to talk about being in the top quintile. What you do here is to have a habit of creating learning exhaust. Write blogs and tutorials and cheatsheets. Speak at meetups and conferences. Ask and answer things on Stackoverflow or Reddit. (Avoid the walled gardens like Slack and Discourse, they're not public). Make Youtube videos

@fernandoaleman
fernandoaleman / mysql2-mojave.md
Last active February 7, 2024 19:19
Install mysql2 on MacOS Mojave

For MacOS Catalina, visit Install mysql2 on MacOS Catalina

Problem

Installing mysql2 gem errors on MacOS Mojave.

Solution

Make sure openssl is installed on Mac via Homebrew.

@qbig
qbig / ethereum_ecrecover_native_contract.go
Created September 16, 2018 14:48 — forked from dominiek/ethereum_ecrecover_native_contract.go
ethereum_ecrecover_native_contract.go
// ECRECOVER implemented as a native contract.
type ecrecover struct{}
func (c *ecrecover) RequiredGas(input []byte) uint64 {
return params.EcrecoverGas
}
func (c *ecrecover) Run(input []byte) ([]byte, error) {
const ecRecoverInputLength = 128
@qbig
qbig / metamask_ethereum_signing.js
Created September 16, 2018 14:48 — forked from dominiek/metamask_ethereum_signing.js
metamask_ethereum_signing.js
// For eth_sign, we need to sign arbitrary data:
signMessage (withAccount, data) {
const wallet = this._getWalletForAccount(withAccount)
const message = ethUtil.stripHexPrefix(data)
var privKey = wallet.getPrivateKey()
var msgSig = ethUtil.ecsign(new Buffer(message, 'hex'), privKey)
var rawMsgSig = ethUtil.bufferToHex(sigUtil.concatSig(msgSig.v, msgSig.r, msgSig.s))
return Promise.resolve(rawMsgSig)
}
@qbig
qbig / ethereum_smart_contract_ecrecover.sol
Created September 16, 2018 14:47 — forked from dominiek/ethereum_smart_contract_ecrecover.sol
ethereum_smart_contract_ecrecover.sol
function getOriginAddress(bytes32 signedMessage, uint8 v, bytes32 r, bytes32 s) constant returns(address) {
bytes memory prefix = "\x19Ethereum Signed Message:\n32";
bytes32 prefixedHash = keccak256(prefix, signedMessage);
return ecrecover(prefixedHash, v, r, s);
}
@qbig
qbig / ethereum_web3_signing.js
Created September 16, 2018 14:47 — forked from dominiek/ethereum_web3_signing.js
Ethereum Web3 Signing
const message = web3.sha3('Hello World');
const signature = await web3.eth.sign(account, message);
const { v, r, s } = ethUtil.fromRpcSig(signature);