Skip to content

Instantly share code, notes, and snippets.

@shobhitic
shobhitic / Soulbound.sol
Last active March 9, 2024 07:45
Soulbound or Account bound non transferable NFT - https://youtu.be/90vWC4Z8aPo
// Try using this as URI ipfs://bafkreic6ov4qo4ucd4g4uuyve4h72nc4y2lg7ugtq3n3vxnfp3lojvtmdu
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts@4.7.0/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts@4.7.0/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts@4.7.0/access/Ownable.sol";
import "@openzeppelin/contracts@4.7.0/utils/Counters.sol";
pragma solidity 0.8.0;
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "hardhat/console.sol";
// We need to import the helper functions from the contract that we copy/pasted.
import { Base64 } from "./libraries/Base64.sol";
/**
*Submitted for verification at Etherscan.io on 2021-09-05
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// [MIT License]
/// @title Base64
@sbauch
sbauch / pinAssets.ts
Created August 7, 2021 00:59
NFT.storage loop
import * as fs from 'fs';
import * as path from 'path';
import 'dotenv/config';
import { NFTStorage, File } from "nft.storage";
async function main() {
const storage = new NFTStorage({ token: process.env.NFT_STORAGE_KEY });
const directory = [];
@18dew
18dew / gist:98806f425c7e1dd7a4f7779d7ab7cd70
Last active June 25, 2023 17:24
Solidity Cheatsheet

Solidity Cheatsheet and Best practices

Motivation

This document is a cheatsheet for Solidity that you can use to write Smart Contracts for Ethereum based blockchain.

This guide is not intended to teach you Solidity from the ground up, but to help developers with basic knowledge who may struggle to get familiar with Smart Contracts and Blockchain because of the Solidity concepts used.

Note: If you have basic knowledge in JavaScript, it's easier to learn Solidity.

@miguelmota
miguelmota / pubsub.go
Created October 6, 2018 21:12
Golang redis pub/sub example
package pubsub
import (
"github.com/garyburd/redigo/redis"
log "github.com/sirupsen/logrus"
)
// Service service
type Service struct {
pool *redis.Pool
@xon52
xon52 / xon-GridCanvas.vue
Last active March 5, 2024 09:23
Medium - Flexible Canvas Grid (without blurred lines)
<template>
<canvas class="gridCanvas"
:width="width"
:height="height"
></canvas>
</template>
<script>
export default {
name: 'xon-GridCanvas',
@bapspatil
bapspatil / ExoPlayerDemoFragment.java
Last active May 10, 2020 09:32
Generic code to set up ExoPlayer in a Fragment
/*
** Created by bapspatil
*/
public class ExoPlayerDemoFragment extends Fragment {
@BindView(R.id.video_exoplayer_view) SimpleExoPlayerView mPlayerView;
private SimpleExoPlayer mPlayer;
private Unbinder unbinder;
public ExoPlayerDemoFragment() {
@vickyqian
vickyqian / twitter crawler.txt
Last active May 11, 2024 16:19
A Python script to download all the tweets of a hashtag into a csv
import tweepy
import csv
import pandas as pd
####input your credentials here
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
@GeekyShiva
GeekyShiva / Bing_Wallpaper_Changer.py
Created January 12, 2017 19:41
This is a python script that changes the wallpaper of ubuntu desktop to the bing's photo of the day. Tested successfully on ubuntu 14.04. (kubuntu)
import urllib2
import json
import datetime
import os.path, time
from os.path import expanduser
import gconf
import os
import commands
import ctypes