Skip to content

Instantly share code, notes, and snippets.

View ijonas's full-sized avatar

Ijonas Kisselbach ijonas

View GitHub Profile
@ijonas
ijonas / keybase.md
Created September 17, 2014 14:47
keybase.md

Keybase proof

I hereby claim:

  • I am ijonas on github.
  • I am ijonas (https://keybase.io/ijonas) on keybase.
  • I have a public key whose fingerprint is DE26 F284 D61B 9703 78D7 B94C E3AC 4853 1526 EB62

To claim this, I am signing this object:

@ijonas
ijonas / logrotateconf
Created December 1, 2014 09:57
Quick & dirty Ruby script to generate a whole bunch of logrotate conf files.
#! /usr/bin/env ruby
# license: MIT
# example usage: ./logrotateconf $PWD/newrelic_agent.log > newrelic_agent
conf = <<-eos
{
rotate 14
daily
missingok
create 640 ubuntu ubuntu
notifempty
@ijonas
ijonas / gist:41e3a155e94c64fc4630
Created April 1, 2015 09:05
ReactNative NavigatorIOS component doesn't pass 'navigator' object into props
var CBSupport = React.createClass({
_handleNextButtonPress: function() {
debugger
AlertIOS.alert("Be A Lert");
// this.props does not contain a 'navigator' property
this.props.navigator.push({
component: Login,
title: 'Login'
});
TASK [setup] *******************************************************************
ok: [localhost]
TASK [genesis-digitalocean : Get the default SSH key] **************************
changed: [localhost]
TASK [genesis-digitalocean : Add the SSH key to DigitalOcean if it doesn't already exist] ***
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NameError: name 'DoError' is not defined
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Traceback (most recent call last):\n File \"/var/folders/b_/pqyqvn4s0xldl2cm4mfnqkb00000gn/T/ansible_8biPQo/ansible_module_digital_ocean.py\", line 187, in <module>\n class TimeoutError(DoError):\nNameError: name 'DoError' is not defined\n", "module_stdout": "", "msg": "MODULE FAILURE", "parsed": false}
@ijonas
ijonas / gist:0386c6e01c1479c9321e162be137d95c
Created September 19, 2016 21:39
How to handle errors in #golang
Below are a bunch of resources that help you grok error handling in Go.
* Listen to Go Time Podcast #16, specifically the parts on error handling https://changelog.com/gotime-16/
* Read http://dave.cheney.net/2016/04/27/dont-just-check-errors-handle-them-gracefully
* Read http://dave.cheney.net/2016/06/12/stack-traces-and-the-errors-package
* Use the errors pkg for some syntactic sugar... https://godoc.org/github.com/pkg/errors
Use Dave Cheney's "rules"... either handle the error locally and then never again (e.g. log to stderr) OR
pass the error up the call stack. Consider annotating the error... errors.Wrapf(err, "Unable to access %s upload folder", account)
before passing it back up the stack.
# DEV
account_id = 3
case_type_id = 22
bucket_id = 102
admin_user_id = 8
current_state_id = 72
# QA
account_id = 1
case_type_id = 18
pragma solidity 0.7.1;
import "https://github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/interfaces/IUniswapV2Router02.sol";
contract UniswapExample {
address internal constant UNISWAP_ROUTER_ADDRESS = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ;
IUniswapV2Router02 public uniswapRouter;
address private multiDaiKovan = 0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa;
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.8.7;
pragma abicoder v2;
import './TransferHelper.sol';
import './ISwapRouter.sol';
contract SwapExamples {
// For the scope of these swap examples,
// we will detail the design considerations when using
@ijonas
ijonas / CallingContract.sol
Last active April 5, 2022 12:20
Fetching a string-value via an Oracle
contract MyContract {
string public lastMarket;
function requestEthereumLastMarket(address _oracle, string memory _jobId)
public
onlyOwner
{
Chainlink.Request memory req = buildChainlinkRequest(stringToBytes32(_jobId), address(this), this.fulfillEthereumLastMarket.selector);
req.add("get", "https://min-api.cryptocompare.com/data/pricemultifull?fsyms=ETH&tsyms=USD");
type = "directrequest"
schemaVersion = 1
name = "Get > Uint256 0.05LINK"
minContractPaymentLinkJuels = 50000000000000000
maxTaskDuration = "0s"
contractAddress = "CONTRACT ADDRESS"
minIncomingConfirmations = 0
observationSource = """
decode_log [type="ethabidecodelog"
abi="OracleRequest(bytes32 indexed specId, address requester, bytes32 requestId, uint256 payment, address callbackAddr, bytes4 callbackFunctionId, uint256 cancelExpiration, uint256 dataVersion, bytes data)"