Skip to content

Instantly share code, notes, and snippets.

View vdparikh's full-sized avatar

Vishal Parikh vdparikh

View GitHub Profile
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "forge-std/Test.sol";
// This contract is designed to act as a time vault.
// User can deposit into this contract but cannot withdraw for atleast a week.
// User can also extend the wait time beyond the 1 week waiting period.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
/*
EtherStore is a contract where you can deposit and withdraw ETH.
This contract is vulnerable to re-entrancy attack.
Let's see why.
1. Deploy EtherStore
2. Deposit 1 Ether each from Account 1 (Alice) and Account 2 (Bob) into EtherStore
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.11;
contract Onwership {
address public owner;
modifier onlyOwner {
require(owner == msg.sender, "You are not the owner");
_;

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

import stebo
@vdparikh
vdparikh / worksheet.sql
Created February 23, 2020 16:51
Create Read Only Snowflake Group and User
# CREATE A READ ONLY GROUP
create role read_only_svc_rl comment = 'This role is limited to querying tables';
grant role read_only_svc_rl to role sysadmin;
# GRANT USAGE ON DATABASE
grant usage on database databots_prod to role read_only_svc_rl;
# GRANT USAGE ON CURRENT SCHEMAS AND FUTURE SCHEMAS
grant usage on all schemas in database databots_prod to role read_only_svc_rl;
grant usage on future schemas in database databots_prod to role read_only_svc_rl;
@vdparikh
vdparikh / api.go
Created March 17, 2019 19:26
Wrap GoLang Echo server in Lambda handler for API Gateway
package main
import(
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
"github.com/labstack/echo"
"github.com/labstack/echo/middleware"
)
func main() {
@vdparikh
vdparikh / snowflake.go
Created March 14, 2019 17:46
simple snowflake database query from Go and return results as JSON
package main
import (
"database/sql"
"encoding/json"
"log"
"reflect"
"time"
sf "github.com/snowflakedb/gosnowflake"
@vdparikh
vdparikh / enum.go
Created March 10, 2019 19:37 — forked from lummie/enum.go
Golang Enum pattern that can be serialized to json
package enum_example
import (
"bytes"
"encoding/json"
)
// TaskState represents the state of task, moving through Created, Running then Finished or Errorred
type TaskState int
@vdparikh
vdparikh / template.yaml
Created March 2, 2019 18:12
AWS Glue SAM Template
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
Lab Data Analytics.
Parameters:
StudentLabDataBucket:
Type: String
Globals:
Function:
Runtime: python3.6 # language used at runtime