Skip to content

Instantly share code, notes, and snippets.

Rahul Sethuram rhlsthrm

Block or report user

Report or block rhlsthrm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View 3Box
3Box is a social profiles network for web3. This post links my 3Box profile to my Github account!
✅ did:muport:QmZZQ3eTyyxKXyGv7GLdHGQWFg3BthznK9UeTGFaWdHpVw ✅
Create your profile today to start building social connection and trust online. https://3box.io/
@rhlsthrm
rhlsthrm / MockDai.sol
Created Mar 1, 2019
Mintable token using latest OpenZeppelin contracts, for Solidity ^0.5.2.
View MockDai.sol
pragma solidity ^0.5.2;
/**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
View MolochFlat.sol
pragma solidity 0.5.3;
// produced by the Solididy File Flattener (c) David Appleton 2018
// contact : dave@akomba.com
// released under Apache 2.0 licence
// input /Users/rahul/Desktop/connext/connext/moloch-monorepo/packages/moloch/contracts/Moloch.sol
// flattened : Friday, 08-Feb-19 19:41:10 UTC
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
@rhlsthrm
rhlsthrm / SwiftAsyncAwaitExample.swift
Last active Jan 31, 2019
Using PromiseKit and AwaitKit to write synchronous looking async code.
View SwiftAsyncAwaitExample.swift
import PromiseKit
import AwaitKit
struct Todo: Decodable {
var userId: Int
var id: Int
var title: String
var completed: Bool
}
@rhlsthrm
rhlsthrm / SwiftCallbackHell.swift
Last active Jan 31, 2019
Swift code to use raw Grand Central Dispatch to make requests
View SwiftCallbackHell.swift
import Foundation
var todos = [String: Any]()
let dispatchGroup = DispatchGroup()
for todo in 0..10 {
let url = URL(string: "https://jsonplaceholder.typicode.com/todos/\(todo)")
dispatchGroup.enter()
let task = URLSession.shared.dataTask(with: url!) { (data, response, error) in
@rhlsthrm
rhlsthrm / ReentrancyToken.sol
Created Oct 9, 2018
Fake ERC20 token that recreates reentrancy attack
View ReentrancyToken.sol
pragma solidity ^0.4.23;
import "./HumanStandardToken.sol";
import "../../LedgerChannel.sol";
contract ReentrancyToken is HumanStandardToken {
LedgerChannel ledgerChannel;
uint256 constant MAX_REENTRIES = 5;
uint256 numReentries = 0;
@rhlsthrm
rhlsthrm / tedious.js
Created Jul 27, 2018
Example of creating and awaiting Promise in Node
View tedious.js
// return a promise so you can await it
function Insert_Machine(msg, callback) {
var result = [];
var connection = new Connection(machine_config);
return new Promise(function(resolve, reject) {
connection.on("connect", function(err) {
var request = new Request( // set up request structure
"INSERT INTO dbo.Data_new (pp_id, d_No, d_Note, d_Data, d_seq, d_machine, d_DateTime) OUTPUT INSERTED.Id VALUES (@pp_id, @d_No, @d_Note, @d_Data, 0, @d_machine, @d_DateTime);",
function(err, rowCount) {
if (err) {
@rhlsthrm
rhlsthrm / insertIntoZohoCRM.js
Created Dec 15, 2017
Node Express API endpoint code to insert records into Zoho CRM. Use library to generate XML and properly encode.
View insertIntoZohoCRM.js
const axios = require('axios')
const xml = require('xml')
const { asyncRequest } = require('../util')
const { getModels } = require('../models')
const querystring = require('querystring')
const handler = async (req, res) => {
const { MailingList } = getModels()
const { email } = req.body
View keybase.md

Keybase proof

I hereby claim:

  • I am rhlsthrm on github.
  • I am rhlsthrm (https://keybase.io/rhlsthrm) on keybase.
  • I have a public key ASAQ4qooOAk2XGA9jkZO4Jf-Cz18h2tZ3hhb1IoeF2VQzQo

To claim this, I am signing this object:

View UdemyEthCourse.md
  • Working genesis.json:

`{ "config": { "chainId": 15, "homesteadBlock": 0, "eip155Block": 0, "eip158Block": 0 }, "alloc": {},

You can’t perform that action at this time.