Skip to content

Instantly share code, notes, and snippets.

pragma solidity ^0.4.18;
contract CardGuess {
address guesser = 0x0;
uint256 unlockblock = 0;
uint256 window = 10;
bytes32 public hash = 0x28c6468c5e6cd0cd9dac3b0cdfe6c9fde6593813f4a83628fa81f7099b4cf4e9;
function commit () public {
require(unlockblock < block.number);
guesser = msg.sender;
unlockblock = block.number + window;
@io4
io4 / MultiCat.sol
Created December 1, 2017 23:30
Multisig solidity wallet
pragma solidity ^0.4.18;
contract ERC721 {
function totalSupply() public view returns (uint256 total);
function balanceOf(address _owner) public view returns (uint256 balance);
function ownerOf(uint256 _tokenId) external view returns (address owner);
function approve(address _to, uint256 _tokenId) external;
function transfer(address _to, uint256 _tokenId) external;
function transferFrom(address _from, address _to, uint256 _tokenId) external;
event Transfer(address from, address to, uint256 tokenId);
event Approval(address owner, address approved, uint256 tokenId);
@io4
io4 / CatHODL.sol
Created December 1, 2017 02:48
A contract to force HODL-ing cats
pragma solidity ^0.4.18;
contract ERC721 {
function totalSupply() public view returns (uint256 total);
function balanceOf(address _owner) public view returns (uint256 balance);
function ownerOf(uint256 _tokenId) external view returns (address owner);
function approve(address _to, uint256 _tokenId) external;
function transfer(address _to, uint256 _tokenId) external;
function transferFrom(address _from, address _to, uint256 _tokenId) external;
event Transfer(address from, address to, uint256 tokenId);
event Approval(address owner, address approved, uint256 tokenId);
const EventEmitter = require("events");
function wrap(ev, def){
ev.__events = ev._events;
ev._eif = {};
ev._dobreak = {};
ev._events = new Proxy(ev.__events, {
get: function(t, p, r) {
if(p == "newListener") return;
if( !ev.__events[p] || (typeof ev.__events[p] == "object" && ev.__events[p].length == 0)) {
return def;
@io4
io4 / index.js
Created March 25, 2017 03:21
Linux-like permission thing
function parseNumericPerms (s) {
var operm = parseInt(s,8); // octal
function i (a) {
return Boolean(operm&(2**(a-1)));
}
return {
o: {r:i(3),w:i(2),x:i(1)},
g: {r:i(6),w:i(5),x:i(4)},
u: {r:i(9),w:i(8),x:i(7)}
}
@io4
io4 / index.js
Created March 10, 2017 21:25
Fixed code
function packFORMAT (data){
var body = BSON.serialize(data);
var cbody = Buffer(algorithm.compressFile(body),"binary");
var final = Buffer.concat([Buffer.from("MAGIC", "binary"), Buffer.from([data.origin.majorVersion,0x4,0x99,0x60])])
var dlen = body.length;
final = Buffer.concat([final,Buffer([dlen,dlen>>8,dlen>>16,dlen>>24],"binary")])
final = Buffer.concat([final,Buffer(cbody,"binary")]);
return final.toString("binary");
}
@io4
io4 / main.js
Created February 28, 2017 23:11
[ROOT] Make node.js takeover a tty. Do Ctrl-Alt-F3
const fs = require("fs");
const child_process = require("child_process");
var stdio = [
fs.openSync("/dev/tty3","w+"),
fs.openSync("/dev/tty3","r+"),
fs.openSync("/dev/tty3","r+")
];
child_process.spawn("/bin/bash", [], {stdio});
@io4
io4 / example.js
Created October 6, 2016 00:05
VoidLang implementation
var run = require("./parser");
run(",&[!#]|^&",false,function(o){
console.log("> "+o);
});
@io4
io4 / TODO.md
Created May 13, 2016 21:55
ezzybot's TODO

TODO LIST:

  • Finish this TODO list
  • Improve Wiki
  • Add database to ezzybot
  • Add actual content to website
  • Get ezzybot registered as a group Iovoid's suggestions
  • Ban tracking (that follows $j)
  • Support of configurable channel-specific ban-channels.
  • Support config being a string, with file name with config.
@io4
io4 / README.md
Last active August 29, 2015 14:24
Node.js Farmerbot

To use it: Run "npm install node-irc" Set owner to your nick. Do "node bot.js" Wait for it to collect monney!