Skip to content

Instantly share code, notes, and snippets.

View leopard627's full-sized avatar
🦖
Working from home

Leopard627 leopard627

🦖
Working from home
View GitHub Profile
@shobhitic
shobhitic / MyNFT.sol
Last active August 12, 2023 03:08
Simple NFT Staking Smart Contract - https://youtu.be/m0w6JyqJKks
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/[email protected]/token/ERC721/ERC721.sol";
import "@openzeppelin/[email protected]/access/Ownable.sol";
contract MyNFT is ERC721, Ownable {
uint256 public totalSupply;
constructor() ERC721("MyNFT", "MNFT") {}
@delthas
delthas / sni.go
Last active January 4, 2023 12:43
Disable SNI in Go HTTPS requests
url := "https://perdu.com"
hostname := "perdu.com"
sni := false
var serverName string
if sni {
serverName = hostname
} else {
// disable sending the ServerName by using an IP
@john-science
john-science / python.dockerfile
Last active July 11, 2021 22:56
Installing Python v3.8 dev on Ubuntu 20.04 via Docker
FROM ubuntu:20.04
RUN apt-get update && \
apt-get install --no-install-recommends -y python3-pip python3.8-dev && \
apt-get install vim && \
apt-get install git
@timhughes
timhughes / fastapi_websocket_redis_pubsub.py
Last active August 10, 2024 12:07
FastAPI Websocket Bidirectional Redis PubSub
"""
Usage:
Make sure that redis is running on localhost (or adjust the url)
Install uvicorn or some other asgi server https://asgi.readthedocs.io/en/latest/implementations.html
pip install -u uvicorn
Install dependencies
@alucard001
alucard001 / GoogleIndexing.py
Created May 27, 2019 04:49
Google Indexing API V3 Working example with Python 3
from oauth2client.service_account import ServiceAccountCredentials
import httplib2
import json
import pandas as pd
# https://developers.google.com/search/apis/indexing-api/v3/prereqs#header_2
JSON_KEY_FILE = "json_key_file_downloaded_after_creating_your_google_service_account_see_above_details_on_how_to_do.json"
SCOPES = ["https://www.googleapis.com/auth/indexing"]
@joshuacerbito
joshuacerbito / useScroll.js
Last active January 8, 2024 13:44
Custom React hook for listening to scroll events
/**
* useScroll React custom hook
* Usage:
* const { scrollX, scrollY, scrollDirection } = useScroll();
*/
import { useState, useEffect } from "react";
export function useScroll() {
const [lastScrollTop, setLastScrollTop] = useState(0);
use std::thread;
use std::sync::mpsc;
use std::sync::Arc;
use std::sync::Mutex;
enum Message {
NewJob(Job),
Terminate,
}
@uraimo
uraimo / dnsovertls.md
Last active May 27, 2024 18:17
Configure your Mac to use DNS over TLS
@subicura
subicura / docker-prom-stack.yml
Last active January 10, 2020 22:27
docker-prom-stack.yml
version: "3"
networks:
monitoring:
services:
cadvisor:
image: google/cadvisor:${CADVISOR_VERSION:-v0.26.1}
networks:
- monitoring
@akexorcist
akexorcist / index.js
Last active September 13, 2024 19:03
Axios post method requesting with x-www-form-urlencoded content type. See https://axios-http.com/docs/urlencoded
const axios = require('axios')
/* ... */
const params = new URLSearchParams()
params.append('name', 'Akexorcist')
params.append('age', '28')
params.append('position', 'Android Developer')
params.append('description', 'birthdate=25-12-1989&favourite=coding%20coding%20and%20coding&company=Nextzy%20Technologies&website=http://www.akexorcist.com/')
params.append('awesome', true)