Skip to content

Instantly share code, notes, and snippets.

@adamazad
adamazad / Multiple Deploy Keys in GitHub.md
Created November 21, 2022 14:02 — forked from mcfdn/Multiple Deploy Keys in GitHub.md
Using multiple GitHub deploy keys on a single server with a single user

Using multiple GitHub deploy keys on a single server with a single user

Within GitHub it is possible to set up two types of SSH key - account level SSH keys and and repository level SSH keys. These repository level SSH keys are known in GitHub as deploy keys.

Deploy keys are useful for deploying code because they do not rely on an individual user account, which is susceptible to change, to “store” the server keys.

There is, however, an ‘issue’ with using deploy keys; each key across all repositories on GitHub must be unique. No one key can be used more than once. This becomes a problem when deploying to repositories to the same server with the same user. If you create two keys, the SSH client will not know which key to use when connecting to GitHub.

One solution is to use an SSH config file to define which key to use in which situation. This isn’t as easy as it seems.. you might try something like this:

@adamazad
adamazad / esm-package.md
Created November 4, 2022 08:58 — forked from sindresorhus/esm-package.md
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@adamazad
adamazad / .dockerignore
Created September 21, 2022 09:39
Swapr docker
node_modules
.netlify
.github
.vscode
build
cypress
tests
yarn-error.log
npm-debug.log
.storybook
@adamazad
adamazad / docker-compose.yml
Created August 23, 2022 10:12
Run Local Graph Node
version: '3'
services:
graph-node:
image: graphprotocol/graph-node:v0.27.0
ports:
- '8000:8000'
- '8001:8001'
- '8020:8020'
- '8030:8030'
- '8040:8040'
@adamazad
adamazad / transaction.ts
Created August 6, 2022 11:01
Swapr subgraph: parse transactions
import { Address, ethereum, log } from '@graphprotocol/graph-ts'
import { Mint, Transfer } from '../types/templates/Pair/Pair'
/**
* The method ID for:
* `Transfer(address indexed from, address indexed to, uint256 value)`
*/
export let TRANSFER_METHOD_ID = '0xddf252ad'
/**
* The method ID for:
@adamazad
adamazad / index.ts
Last active May 18, 2022 18:41
Swapr Uniswap V2 integration
import {
ChainId,
Percent,
Token,
TokenAmount,
UniswapV2RoutablePlatform,
UniswapV2Trade,
} from '@swapr/sdk'
import { getAllCommonPairs } from '@swapr/sdk/dist/entities/trades/uniswap-v2/contracts'
import { utils, providers } from 'ethers'

Deploy subgraph to The Graph Hosted Service

Set token

npx graph auth --product hosted-service https://api.thegraph.com/deploy/ <access-token> 

Upload