Skip to content

Instantly share code, notes, and snippets.

View ethereumdegen's full-sized avatar

Ethereumdegen ethereumdegen

View GitHub Profile
@mudgen
mudgen / using-delegatecall-safely.sol
Last active September 20, 2020 18:18
Example showing how to use DELEGATECALL
// Author: Nick Mudge (https://twitter.com/mudgen)
// This is part of my tweet thread, "Six things you need to know to use DELEGATECALL safely": https://twitter.com/mudgen
// Shows how to use DELEGATECALL
// Using OpenZeppelin's Address library check to see if
// myContract has code.
require(Address.isContract(myContractAddress), "Address has no code");
// Set function argument we are going to use.
uint myArg = 10;
@tomconte
tomconte / compile-deploy-sign.js
Created January 3, 2017 14:25
Shows how to compile and deploy a Smart Contract using client-side transaction signature, i.e. does not require the account to be unlocked in the Ethereum node.
const fs = require('fs');
const solc = require('solc');
const Web3 = require('web3');
const Tx = require('ethereumjs-tx')
// Private key to use to sign the transactions
// To decrypt your private key, use e.g. https://www.myetherwallet.com/#view-wallet-info
// You will find your private key file in e.g. .ethereum/keystore or .parity/keys
// In this example the key should correspond to the web3.eth.coinbase address
var privateKey = new Buffer('088c110b6861b6c6c57461370d661301b29a7570d59cb83c6b4f19ec4b47f642', 'hex')
@xabikos
xabikos / remote react bootstrap table example
Last active July 8, 2021 00:16
An example of a react bootstrap table that fetches the data asynchronously when navigating between pages and when changing the page size
import React, {Component} from 'react';
import {BootstrapTable, TableHeaderColumn} from 'react-bootstrap-table';
import _ from 'lodash';
const dataTable = _.range(1, 60).map(x => ({id: x, name: `Name ${x}`, surname: `Surname ${x}`}));
// Simulates the call to the server to get the data
const fakeDataFetcher = {
fetch(page, size) {
return new Promise((resolve, reject) => {
@eclubb
eclubb / sqlite2pg.sh
Created March 30, 2012 17:20
Script to import SQLite3 database into PostgreSQL
#!/bin/sh
# This script will migrate schema and data from a SQLite3 database to PostgreSQL.
# Schema translation based on http://stackoverflow.com/a/4581921/1303625.
# Some column types are not handled (e.g blobs).
SQLITE_DB_PATH=$1
PG_DB_NAME=$2
PG_USER_NAME=$3