Skip to content

Instantly share code, notes, and snippets.

View kevinmcmahon's full-sized avatar

Kevin McMahon kevinmcmahon

View GitHub Profile
@dabit3
dabit3 / marketplace.sol
Last active March 14, 2024 15:55
NFT Marketplace Smart Contract (V2)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "hardhat/console.sol";
contract NFTMarketplace is ERC721URIStorage {
@ryancharris
ryancharris / Base64.sol
Created January 23, 2022 00:22
Solidity Base64 utilities
pragma solidity >=0.8.0 <0.9.0;
// SPDX-License-Identifier: MIT
/// [MIT License]
/// @title Base64
/// @notice Provides a function for encoding some bytes in base64
/// @author Brecht Devos <brecht@loopring.org>
library Base64 {
bytes internal constant TABLE =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@ciaranmcnulty
ciaranmcnulty / notes.md
Last active March 25, 2024 06:36
Notes on using Docker on ARM Macs (November 2021)

Docker for Mac

On M1 machines, Docker for Mac is running a lightweight linux ARM VM, then running containers within that, so containers are essentially running natively. Don't be fooled by the fact the UI or binary CLI tools (e.g. docker) might require Rosetta.

Within that VM is an emulation layer called QEmu. This can be used by docker to run Intel containers. This does not use Rosetta at all, and has a roughly 5-6X performance penalty. (If you just upgraded your CPU this may result in a similar performance to your old machine!)

Pulling and running with Docker

Many images in public registries are multi-architecture. For instance at the time of writing on Docker Hub the php:8.0-cli image has the following digests:

@merlinmann
merlinmann / wisdom.md
Last active April 17, 2024 21:52
Merlin's Wisdom Project (Draft)

Merlin's Wisdom Project

Or: “Everybody likes being given a glass of water.”

By Merlin Mann.

It's only advice for you because it had to be advice for me.

@dabit3
dabit3 / combined-config.js
Created October 29, 2020 17:33
Combining CDK outputs with Amplify configuration
import Amplify from 'aws-amplify';
const { AppsyncCdkAppStack } = require('./outputs.json');
import config from './aws-exports';
Amplify.configure({
...config,
aws_appsync_graphqlEndpoint: AppsyncCdkAppStack.GraphQLAPIURL,
aws_appsync_apiKey: AppsyncCdkAppStack.GraphQLAPIKey
})
export class BaseStack extends cdk.Stack {
public readonly stageName?: string;
public readonly serviceName?: string;
constructor(scope: cdk.Construct, id: string, props: IBaseStack) {
const superProps = {
...(props.stageName && { stackName: `${props.stageName}-${id}` }),
...props,
};
super(scope, id, superProps);
@MatthewKosloski
MatthewKosloski / ssh_cheatsheet.md
Last active December 12, 2021 07:07
SSH Cheatsheet

SSH Cheatsheet

You know how it goes. SSH is something that nearly every developer uses every day, however, they only set it up a couple of times and then forget about it. And whenever you need to authenticate with SSH again, you just look up how to do it, never remembering how to do it because why would you?

SSH Protocol

What is it?

SSH, which stands for Secure Shell, is a network protocol that enables a client to securely connect to a remote server. All user authentication, commands, outputs, and file transfers are encrypted to protect against attacks in the network. It is a more secure alternative to non-protected login protocols such as FTP.

@guga31bb
guga31bb / nflscrapr.md
Last active August 18, 2023 07:45
Simple guide for using nflscrapR

THIS IS OUTDATED. PLEASE FOLLOW THE FOLLOWING LINK

--> A beginner's guide to nflfastR <--

Basic nflscrapR tutorial

I get a lot of questions about how to get nflscrapR up and running. This guide is intended to help new users build interesting tables or charts from the ground up, taking the raw nflscrapR data.

Quick word if you're new to programming: all of this is happening in R. Obviously, you need to install R on your computer to do any of this. Make sure you save what you're doing in a script (in R, File --> New script) so you can save your work and run multiple lines of code at once. To run code from a script, highlight what you want, right click, and select Run line. As you go through your R journey, you might get stuck and have to google a bunch of things, but that's totally okay and normal. That's how I wrote this thing!

func submit() {
guard let name = nameField.text else {
show("No name to submit")
return
}
guard let address = addressField.text else {
show("No address to submit")
return
}