Skip to content

Instantly share code, notes, and snippets.

View caffeinum's full-sized avatar
🐶
Coffee Driven Development

Aleksey Bykhun caffeinum

🐶
Coffee Driven Development
View GitHub Profile
@caffeinum
caffeinum / EthToSmthSwaps.sol
Created July 13, 2018 18:47
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&gist=
pragma solidity ^0.4.23;
import './SafeMath.sol';
contract EthToSmthSwaps {
using SafeMath for uint;
address public owner;
address public ratingContractAddress;
@caffeinum
caffeinum / EthToSmthSwaps.sol
Created July 13, 2018 18:55
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&gist=
pragma solidity ^0.4.23;
// ----------------------------------------------------------------------------
// Safe maths from OpenZeppelin
// ----------------------------------------------------------------------------
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns(uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
@caffeinum
caffeinum / AtomicSwap.sol
Created July 17, 2018 09:45
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=true&gist=
pragma solidity ^0.4.23;
contract AtomicSwap {
uint256 SafeTime = 3 hours; // atomic swap timeOut
struct Swap {
bytes32 secret;
bytes32 secretHash;
@caffeinum
caffeinum / simple-send.js
Last active September 25, 2020 12:25
Pure-JS OmniLayer sendtx
const bitcoin = require('bitcoinjs-lib') // version @3.3.2, ver4 won't work
const request = require('request-promise-native')
const net = process.env.NETWORK === 'testnet'
? bitcoin.networks.testnet
: bitcoin.networks.bitcoin
const API = net === bitcoin.networks.testnet
? `https://test-insight.swap.online/insight-api`
: `https://insight.bitpay.com/api`

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@caffeinum
caffeinum / RESTREAM.md
Last active November 24, 2020 13:56
RTMP Server Basic setup

Setup restream with NGINX

  1. Install FFMPEG
  2. Setup rtmp application for restream
  3. Test
@caffeinum
caffeinum / imagine.tsx
Last active December 10, 2020 03:05
GPT-3 Imagine
// A. So we have a React component
// B. that is a modal popup
// C. it has two buttons: Apply and Cancel
// D. when you press cancel, it hides itself
// E. when you press Apply, the function callback
// F. that was passed through props, is called
// G. Also, popup can draw inherited HTML fetched from props.children
// H. Bonus question! It looks wrong.
// Please add the dark overlay over background, and make the buttons more in style with the rest of the project
@caffeinum
caffeinum / APIConsumer.sol
Created January 29, 2021 08:43
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.6.12+commit.27d51765.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
/** This example code is designed to quickly deploy an example contract using Remix.
* If you have never used Remix, try our example walkthrough: https://docs.chain.link/docs/example-walkthrough
* You will need testnet ETH and LINK.
* - Kovan ETH faucet: https://faucet.kovan.network/
* - Kovan LINK faucet: https://kovan.chain.link/
*/
pragma solidity ^0.6.0;
@caffeinum
caffeinum / .deps...npm...@openzeppelin...contracts@4.2.0...access...Ownable.sol
Last active August 20, 2021 13:36
TigersFightClub.sol 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.8.4+commit.c7e474f2.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.