Skip to content

Instantly share code, notes, and snippets.

View pcdinh's full-sized avatar

Pham Cong Dinh pcdinh

View GitHub Profile
@jebright
jebright / main.dart
Created April 16, 2019 19:12
Using an Isolate in Flutter
import 'dart:async';
import 'package:flutter/material.dart';
import 'dart:isolate';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
@mraleph
mraleph / ffi.md
Last active November 11, 2023 14:44

Dart VM FFI Vision

Background

The aim of Dart FFI project (tracked as Issue #34452) is to provide a low boilerplate, low ceremony & low overhead way of interoperating with native C/C++ code.

The motivation behind this project is twofold:

@steven2358
steven2358 / ffmpeg.md
Last active April 21, 2024 02:08
FFmpeg cheat sheet
@Spindel
Spindel / directio_mmap.py
Created December 9, 2016 17:44
Direct IO in Python
#!/bin/env python3
import os
import mmap
import logging
import hashlib
import contextlib
log = logging.getLogger(__name__)
@contextlib.contextmanager
def directio_mmap(filename, readsize, offset):
@justusranvier
justusranvier / fraud proofs.md
Last active July 14, 2019 16:57
Improving the ability of SPV clients to detect invalid chains

SPV clients lack the ability of full nodes to detect whether or not a chain provided to them by another source complies with the rules of the Bitcoin protocol.

SPV clients can connect to multiple full nodes in the hope that at least one of the nodes is honest and will provide them with the best valid chain, however situations may arise where the non-compliant chain contains more proof of work than the compliant chain. In this situation, there is no way for the honest full node to signal to an SPV client that it should disregard the chain with more proof of work.

Fraud proofs are a technique which provide honest full nodes the capability to conclusively demonstrate that chain is invalid regardless of the amount of proof of work backing the invalid chain.

If Bitcoin nodes implement the ability to create, propagate, and verify fraud proofs, the security of SPV clients will be improved.

Assumptions and Definitions

@oleganza
oleganza / impulse_review.md
Last active January 23, 2016 06:24
Impulse Review

(That's my attempt to understand what problem Impulse solves and how. I am not a designer/developer of this scheme.)

Problem

Regular Bitcoin transactions are not guaranteed until mined sufficiently deep in the blockchain. Unconfirmed transactions can be observed nearly instantly, but they cannot be trusted (could drop out because of insufficient fees, or double-spent).

Impulse Overview

@malcolmboyd
malcolmboyd / Bitcoin Price Scraper
Created November 28, 2014 06:11
A python script to scrape the bitcoin price and notify the user via sms message and desktop notification on linux.
#!/usr/bin/python3
import requests, subprocess, time, smtplib
from email.mime.text import MIMEText
from bs4 import BeautifulSoup
class BitcoinPrice:
price = 0
website = "http://www.bitcoinexchangerate.org/"
@gavinandresen
gavinandresen / BlockPropagation.md
Last active March 14, 2023 09:45
O(1) block propagation

O(1) Block Propagation

The problem

Bitcoin miners want their newly-found blocks to propagate across the network as quickly as possible, because every millisecond of delay increases the chances that another block, found at about the same time, wins the "block race."

@fragoulis
fragoulis / unaccent.rules
Last active June 10, 2022 11:19
Postgres unaccent rules for greek characters
À A
Á A
 A
à A
Ä A
Å A
Æ A
à a
á a
â a