Skip to content

Instantly share code, notes, and snippets.

View liushooter's full-sized avatar

Shooter liushooter

View GitHub Profile
@nathan-websculpt
nathan-websculpt / OpenZeppelin_ReentrancyGuard.sol
Created September 22, 2021 18:03
Here is an example of the OpenZeppelin Reentrancy Guard in use
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.3/contracts/security/ReentrancyGuard.sol";
contract Attackee is ReentrancyGuard {
mapping(address => uint) public attackeeBalances;
function depositIntoAttackee() external payable {
@RubenSomsen
RubenSomsen / BMM.md
Last active November 14, 2023 02:21
Blind Merged Mining with covenants ( sighash_anyprevout / op_ctv )

Blind Merged Mining with covenants ( sighash_anyprevout / op_ctv )

Update: the content of this gist is also explained in this Spacechains video.

This write-up was also published on bitcoin-dev.

Blind Merged Mining (BMM) is the idea of committing the hash of another blockchain into a unique location on the Bitcoin blockchain, and paying a Bitcoin fee to miners for the privilege of deciding this hash and capturing the fees inside the other blockchain. Since miners don’t have to know what the hash represents and are simply incentivized to choose the highest bidder, it requires no extra validation on their part (“blind”). This idea was originally conceived of by Paul Sztorc, but required a specific soft fork. [0]

In essence, BMM is a mechanism that allows external blockchains (altcoins, tokens) to outsource their mining to the Bitcoin blockchain. Instead of burning electricity with ASICs, th

//Mozilla Public License 2.0 
//As per https://github.com/ethereumjs/ethereumjs-vm/blob/master/LICENSE
//Requires the following packages to run as nodejs file https://gist.github.com/tpmccallum/0e58fc4ba9061a2e634b7a877e60143a

//Getting the requirements
var Trie = require('merkle-patricia-tree/secure');
var levelup = require('levelup');
var leveldown = require('leveldown');
var utils = require('ethereumjs-util');
@linkerlin
linkerlin / mmap_demo.go
Created January 24, 2018 15:45
A demo of mmap for Go
package main
import (
"bytes"
"encoding/binary"
"os"
"sync"
"fmt"
"math/rand"
"path/filepath"
package main
import (
"github.com/syndtr/goleveldb/leveldb"
"fmt"
"encoding/binary"
"github.com/ethereum/go-ethereum/core/types"
"bytes"
"github.com/ethereum/go-ethereum/rlp"
)
@doitian
doitian / rails-cookie-decrypt.go
Created September 23, 2017 07:30
rails session encrypt
@zz
zz / Shadowsocks服务端性能优化.md
Created August 12, 2017 01:35 — forked from cyanife/Shadowsocks服务端性能优化.md
Shadowsocks服务端性能优化

#Shadowsocks服务端性能优化(CentOS6)

##ss加密算法 常用算法aes-256-cfb速度较慢,在路由器等arm平台表现不佳。 用于arm平台时,采用算法rc4-md5即可。 "method":"rc4-md5" 为加速加密速度,安装m2crypto

yum install m2crypto
@nonoroazoro
nonoroazoro / Open with Sublime Text.vbs
Last active September 1, 2021 02:07
Add "Open with Sublime Text" to windows explorer context menu of folders and files - windows 7, 10 (auto elevate UAC)
On Error Resume Next
' 1. Change this to your Sublime Text file path.
path = "C:\Program Files\Sublime Text\sublime_text.exe"
' 2. Optional - Change keyboard shortcut here, for example: "F" if you like.
shortcut = "Q"
Sub ElevateUAC
If Not WScript.Arguments.Named.Exists("elevated") Then
@xiaolai
xiaolai / markdownhere.css
Created July 2, 2016 12:12
markdown-here-css
.markdown-here-wrapper {
font-size: 16px;
line-height: 1.8em;
letter-spacing: 0.1em;
}
pre, code {
font-size: 14px;
font-family: Roboto, 'Courier New', Consolas, Inconsolata, Courier, monospace;
Installing collected packages: requests
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import requests
from datetime import datetime