Skip to content

Instantly share code, notes, and snippets.

View dickolsson's full-sized avatar

Dick Olsson dickolsson

View GitHub Profile
@dickolsson
dickolsson / crontab
Last active January 1, 2018 17:52
OpenWRT root crontab
*/5 * * * * /sbin/fan_ctrl.sh
0 2 * * * opkg list-upgradable | cut -f 1 -d ' ' | xargs opkg upgrade
0 3 * * 6 reboot
@dickolsson
dickolsson / IronDoers.js
Created June 19, 2017 09:25
Example tests for a contract on an Ethereum blockchain
var IronDoers = artifacts.require("./IronDoers.sol");
function assertThrow(err, test, msg) {
if (err.toString().indexOf(test) != -1) {
assert(true, msg);
} else {
assert(false, err.toString())
}
}
@dickolsson
dickolsson / IronDoers.sol
Last active January 8, 2018 12:05
Example contract of an organisation on an Ethereum blockchain
pragma solidity ^0.4.0;
contract IronDoers {
address public trustee;
mapping(address => bool) public doers;
uint public doerCount;
modifier onlyTrustee {
if (msg.sender != trustee) throw;
@dickolsson
dickolsson / truffle.js
Created June 18, 2017 10:03
Example truffle.js for connecting to a local Ethereum blockchain
module.exports = {
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*"
}
}
};
@dickolsson
dickolsson / 1_initial_migration.js
Created June 18, 2017 09:08
Example deployment script of initial contract migrations for an Ethereum blockchain
var Migrations = artifacts.require("./Migrations.sol");
module.exports = function(deployer) {
deployer.deploy(Migrations);
};
@dickolsson
dickolsson / Migrations.sol
Last active June 18, 2017 09:08
Example migration contract for an Ethereum blockchain
pragma solidity ^0.4.4;
contract Migrations {
address public owner;
uint public last_completed_migration;
modifier restricted() {
if (msg.sender == owner) _;
}
@dickolsson
dickolsson / genesis.json
Last active March 6, 2025 13:57
Example genesis.json for an Ethereum blockchain
{
"config": {
"chainId": 33,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"nonce": "0x0000000000000033",
"timestamp": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",

Keybase proof

I hereby claim:

  • I am dickolsson on github.
  • I am dickolsson (https://keybase.io/dickolsson) on keybase.
  • I have a public key whose fingerprint is F71C CD27 7C10 9E6A ED91 900F DDD7 F2AA E87B DA78

To claim this, I am signing this object:

@dickolsson
dickolsson / backup.sh
Last active August 16, 2022 17:13
Simple backup script that will backup package list, files and databases.
#!/bin/sh
#
# A simple Arch Linux backup script.
#
# Example config that targets external mount, keeping backups for a week and
# mirror the backups to local and external disks:
#
# $ cat /etc/backuprc
# backup_target=/mnt/data01/myhost
# backup_days_kept=7
@dickolsson
dickolsson / Vagrantfile
Created October 7, 2014 19:12
Basic Vagrantfile
Vagrant.configure("2") do |c|
c.vm.box = "trusty"
c.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
c.vm.network :private_network, ip: "192.168.33.30"
c.ssh.forward_agent = true
c.vm.synced_folder "./html", "/var/www/html", nfs: true
c.vm.synced_folder "./src", "/usr/local/src", nfs: true