Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond.

Badr bellaj bellaj

💭
I may be slow to respond.
Block or report user

Report or block bellaj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View libstdc20
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:
View libstdc20
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:
View Metamask
<!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);
View test
<!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);
View The Three Go Landmines.markdown

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 Sep 1, 2016 — forked from gavofyork/witness
The Witness Algorithm: Privacy Protection in a Fully Transparent System
View witness
# 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*).
View gist:74295ef34db6632d72e4ca9f4350e9f7
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 Aug 18, 2016
ethstats installation
View pm2 problem
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)
View gist:f04f1c2dc5e24dd753a22338519555ad
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 Jun 1, 2016
My my blockchain ID
View +bellajbadr.txt
Verifying that +bellajbadr is my blockchain ID. https://onename.com/bellajbadr
You can’t perform that action at this time.