Skip to content

Instantly share code, notes, and snippets.

@dkilcy
dkilcy / contracts...AuctionV1.sol
Created December 7, 2021 13:05
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&runs=200&gist=
pragma solidity ^0.4.17;
contract Auction {
// Data
//Structure to hold details of the item
struct Item {
uint itemId; // id of the item
uint[] itemTokens; //tokens bid in favor of the item
}
@dkilcy
dkilcy / contracts...AuctionV1.sol
Created December 6, 2021 21:22
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&runs=200&gist=
pragma solidity ^0.4.17;
contract Auction {
// Data
//Structure to hold details of the item
struct Item {
uint itemId; // id of the item
uint[] itemTokens; //tokens bid in favor of the item
}
@dkilcy
dkilcy / contracts...BallotBasic.sol
Created December 6, 2021 19:03
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.26+commit.4563c3fc.js&optimize=false&runs=200&gist=
pragma solidity ^0.4.0;
contract Ballot {
struct Voter {
uint weight;
bool voted;
uint8 vote;
// address delegate;
}
struct Proposal {

Keybase proof

I hereby claim:

  • I am dkilcy on github.
  • I am dkilcy (https://keybase.io/dkilcy) on keybase.
  • I have a public key ASB_Z8gEY4jumrCyk3uvZvT6dufVpc3eslREdZyrbP30bgo

To claim this, I am signing this object:

@dkilcy
dkilcy / disk-write-performance.md
Created March 8, 2015 15:15
disk-write-performance.md
tune2fs -I 256 /dev/hda1

rw,noatime,barrier=1,data=ordered
commit=300

write caching    $ hdparm -W[01] /dev/sda

write barrier    barrier=[01] in /etc/fstab 
@dkilcy
dkilcy / eat_memory.c
Created February 6, 2015 02:41
Exhaust all memory
int main()
{
while(1)
{
void *m = malloc(1024*1024);
memset(m,0,1024*1024);
}
return 0;
}
@dkilcy
dkilcy / eat_memory.py
Created February 6, 2015 00:29
Program to eat memory and exit
import os
import psutil
PROCESS = psutil.Process(os.getpid())
MEGA = 10 ** 6
MEGA_STR = ' ' * MEGA
def pmem():
#tot, avail, percent, used, free = psutil.virtual_memory()
svmem = psutil.virtual_memory()
@dkilcy
dkilcy / RRDxportSpike.py
Last active September 26, 2017 19:52
Program to detect and correct spikes in RRDtool graph
import math
import pickle
#import rrdtool
import subprocess
import os
import sys
import traceback
import xml.sax
import numpy
@dkilcy
dkilcy / graph1.py
Created January 23, 2015 00:08
RRDtool sample program 1
import calendar
import datetime
import random
import rrdtool
import time
from rrdtool import update as rrd_update
current_time = 0
start = 0
@dkilcy
dkilcy / centos-ipmi.md
Last active August 29, 2015 14:08
CentOS IPMI
dmidecode -t system

yum install OpenIPMI OpenIPMI-tools

service ipmi start
chkconfig ipmi on

ipmitool sel list