Skip to content

Instantly share code, notes, and snippets.

View bellaj's full-sized avatar
🏠
I may be slow to respond.

Badr bellaj bellaj

🏠
I may be slow to respond.
View GitHub Profile
@bellaj
bellaj / libstdc20
Last active October 18, 2019 11:45
Get gcc-libstdc++-4.9.1-1.ram0.99.x86_64.rpm :
wget https://iweb.dl.sourceforge.net/project/ramonelinux/Rel_0.99/releases/x86_64/packages/gcc-libstdc%2B%2B-4.9.1-1.ram0.99.x86_64.rpm
$ rpm2cpio gcc-libstdc++-4.9.1-1.ram0.99.x86_64.rpm | cpio -idmv
Copy libstdc++.so.6.0.20 to /usr/lib64/
Link:
Get gcc-libstdc++-4.9.1-1.ram0.99.x86_64.rpm
Ex.
http://download2.polytechnic.edu.na/pub4/sourceforge/r/ra/ramonelinux/Rel_0.99/releases/x86_64/packages/gcc-libstdc++-4.9.1-1.ram0.99.x86_64.rpm
$ rpm2cpio gcc-libstdc++-4.9.1-1.ram0.99.x86_64.rpm | cpio -idmv
Copy libstdc++.so.6.0.20 to /usr/lib64/
Link:
<!DOCTYPE html>
<script>
window.addEventListener('load', function() {
// Checking if Web3 has been injected by the browser (Mist/MetaMask)
if (typeof web3 !== 'undefined') {
// Use Mist/MetaMask's provider
window.web3 = new Web3(web3.currentProvider);
<!DOCTYPE html>
<script>
window.addEventListener('load', function() {
// Checking if Web3 has been injected by the browser (Mist/MetaMask)
if (typeof web3 !== 'undefined') {
// Use Mist/MetaMask's provider
window.web3 = new Web3(web3.currentProvider);

There are three easy to make mistakes in go. I present them here in the way they are often found in the wild, not in the way that is easiest to understand.

All three of these mistakes have been made in Kubernetes code, getting past code review at least once each that I know of.

  1. Loop variables are scoped outside the loop.

What do these lines do? Make predictions and then scroll down.

func print(pi *int) { fmt.Println(*pi) }
@bellaj
bellaj / witness
Created September 1, 2016 21:18 — forked from gavofyork/witness
The Witness Algorithm: Privacy Protection in a Fully Transparent System
# The Witness Algorithm: Privacy Protection in a Fully Transparent System
By **Vlad Gluhovsky** and **Gavin Wood**
# Introduction
Being based upon a quasi-Turing-complete (quasi because it's actually bounded) virtual machine, Ethereum is an extremely versatile system. However one of its greatest strengths---universal auditability---seems to lead to a fatal flaw, namely an inescapable lack of privacy. Here we demonstrate an algorithm in order to prove that this is not the case.
The algorithm could be used to make an Ethereum contract which, given two sets of addresses sources, `src`, and destinations, `dest`, will guarantee exactly one of two possible eventualities:
- For each address in `src`, the controller of that address controls a corresponding address in `dest` (though the two cannot be related *a priori*).
Python: TypeError: 'list' object is not callable
==> when you try to call a map with () instead of []
Uncaught Error: solc: exit status 1 Error: Doc tag @notice not valid for statements. is caused by a //// comment you should use only //
when you want to fill a array struct
@bellaj
bellaj / pm2 problem
Last active August 18, 2016 09:11
ethstats installation
badr@badr-HP-620:~/bin$ pm2 start processes.json
[PM2][WARN] Applications geth, node-app not running, starting...
/usr/local/lib/node_modules/pm2/lib/CLI.js:461
Common.printOut(cst.PREFIX_MSG + 'App [%s] launched (%d instances)', data[0].pm2_env.name, data.length);
^
TypeError: Cannot read property 'pm2_env' of undefined
at /usr/local/lib/node_modules/pm2/lib/CLI.js:461:85
at /usr/local/lib/node_modules/pm2/node_modules/pm2-axon-rpc/lib/client.js:45:10
at Parser.<anonymous> (/usr/local/lib/node_modules/pm2/node_modules/pm2-axon/lib/sockets/req.js:67:8)
@bellaj
bellaj / gist:f04f1c2dc5e24dd753a22338519555ad
Created August 10, 2016 20:41
solidity smart contract
Solidity lets you program on Ethereum, a blockchain-based virtual machine that allows the creation and execution of smart contracts, without needing centralized or trusted parties.
Solidity is a statically typed, contract programming language that has similarities to Javascript and C. Like objects in OOP, each contract contains state variables, functions, and common data types. Contract-specific features include modifier (guard) clauses, event notifiers for listeners, and custom global variables.
Some Ethereum contract examples include crowdfunding, voting, and blind auctions.
As Solidity and Ethereum are under active development, experimental or beta features are explicitly marked, and subject to change. Pull requests welcome.
// First, a simple Bank contract
// Allows deposits, withdrawals, and balance checks
// simple_bank.sol (note .sol extension)
/* **** START EXAMPLE **** */
@bellaj
bellaj / +bellajbadr.txt
Created June 1, 2016 10:42
My my blockchain ID
Verifying that +bellajbadr is my blockchain ID. https://onename.com/bellajbadr