Skip to content

Instantly share code, notes, and snippets.

@apoorvlathey
apoorvlathey / ERC165.sol
Created November 6, 2023 05:30 — forked from cygaar/ERC165.sol
RareSkills Challenge #3
//SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.15;
import '@openzeppelin/contracts/utils/introspection/ERC165.sol';
import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
contract Award is ERC721 {
constructor() ERC721('Award', 'A') {
_mint(msg.sender, 1337);
}
@apoorvlathey
apoorvlathey / tampermonkey-twitter-report.js
Last active March 14, 2024 17:08 — forked from banteg/twitter-report.js
Tampermonkey userscript: arc boost to report spam on twitter
// ==UserScript==
// @name Twitter Report
// @namespace http://tampermonkey.net/
// @version 0.1
// @description arc boost to report spam on twitter
// @author banteg
// @match *://twitter.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com
// @grant none
// ==/UserScript==

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@apoorvlathey
apoorvlathey / generic.org
Created January 29, 2022 05:11 — forked from hrkrshnn/generic.org
Some generic writeup about common gas optimizations, etc.

Upgrade to at least 0.8.4

Using newer compiler versions and the optimizer gives gas optimizations and additional safety checks for free!

The advantages of versions 0.8.* over <0.8.0 are:

  • Safemath by default from 0.8.0 (can be more gas efficient than some library based safemath.)
  • Low level inliner from 0.8.2, leads to cheaper runtime gas. Especially relevant when the contract has small functions. For
@apoorvlathey
apoorvlathey / DEVS_Snapshot_13612670.json
Created November 14, 2021 14:50
Snapshot of DEVS NFT holders at block #13612670
[
{
"wallet": "0xD5027f11fF85E22D95908fC8dd89C3C459612D23",
"tokenIds": [
"1338",
"7196"
],
"type": "contract"
},
{
@apoorvlathey
apoorvlathey / OHMForks.js
Created November 10, 2021 15:34
List of OHM Forks across different networks.
// Data from: www.fohmo.io
const ohmForks = {
ETH: {
OHM: {
name: "OlympusDAO",
symbol: "OHM",
token: "0x383518188C0C6d7730D91b2c03a03C837814a899",
stakingSymbol: "sOHM",
stakingToken: "0x04F2694C8fcee23e8Fd0dfEA1d4f5Bb8c352111F",
stakingContract: "0xFd31c7d00Ca47653c6Ce64Af53c1571f9C36566a",
@apoorvlathey
apoorvlathey / DeployContract.sol
Created May 24, 2021 05:33
Contract that allows to deploy any arbitrary contract by just passing its initcode as function argument
// For reference: https://twitter.com/nanexcool/status/1396667368017997829
pragma solidity ^0.5.7;
contract DeployContract {
function deploy(bytes memory code) public returns(address addr) {
assembly {
addr := create(0, add(code, 0x20), mload(code))
if iszero(extcodesize(addr)) {
revert(0,0)
const HelpIntentHandler = {
canHandle(handlerInput) {
return Alexa.getRequestType(handlerInput.requestEnvelope) === 'IntentRequest'
&& Alexa.getIntentName(handlerInput.requestEnvelope) === 'AMAZON.HelpIntent';
},
handle(handlerInput) {
const speakOutput = 'To know about the facts, just say Facts'; //just edit this
return handlerInput.responseBuilder
.speak(speakOutput)
exports.handler = Alexa.SkillBuilders.custom()
.addRequestHandlers(
LaunchRequestHandler,
FactsIntentHandler, //your custom intent
HelloWorldIntentHandler,
HelpIntentHandler,
CancelAndStopIntentHandler,
SessionEndedRequestHandler,
IntentReflectorHandler, // make sure IntentReflectorHandler is last so it doesn't override your custom intent handlers
)
const FactsIntentHandler = {
canHandle(handlerInput) {
return Alexa.getRequestType(handlerInput.requestEnvelope) === 'IntentRequest'
&& Alexa.getIntentName(handlerInput.requestEnvelope) === 'FactsIntent';
},
handle(handlerInput) {
var random = factsList.facts[Math.floor(Math.random() * factsList.facts.length)]; //select a random fact from json file
var factText = random.text;
var speakOutput = "Did you know that " + factText;