Skip to content

Instantly share code, notes, and snippets.

View kmjones1979's full-sized avatar
🌴
Vibe Coding

Kevin J kmjones1979

🌴
Vibe Coding
View GitHub Profile
@kmjones1979
kmjones1979 / index.tsx
Created August 9, 2023 23:01
Example table showcasing the messages coming from The Graph using GraphQL
import Link from "next/link";
import type { NextPage } from "next";
import { BugAntIcon, MagnifyingGlassIcon, SparklesIcon } from "@heroicons/react/24/outline";
import { MetaHeader } from "~~/components/MetaHeader";
import { gql } from '@apollo/client';
import { useQuery } from '@apollo/client';
export const GET_MESSAGES = gql`
{
messages(first: 10, orderBy: createdAt, orderDirection: asc) {
@kmjones1979
kmjones1979 / generic.org
Created January 25, 2022 00:32 — 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
@kmjones1979
kmjones1979 / request.py
Created December 14, 2018 18:37
Zip Code Distance Check via API
import requests
import csv
# zip code api variables
API_URL = 'https://api.zip-codes.com/ZipCodesAPI.svc/1.0/CalculateDistance/ByZip?'
ZIPS = ["T5T 4J2", "J3V 5K1", "H9R 1C4", "G1V 2L1", "H7T 1C8", "H3B 5K4", "H3P 3E9", "J4Y 0L1", "H1M 1W9", "J1L 1K1", "G2K 1N4"]
# API Key
APIKEY = 'HIDDEN'
@kmjones1979
kmjones1979 / keepalived.conf
Created June 15, 2017 19:37
Mast keepalived.conf
vrrp_script chk_nginx_service {
script "/usr/lib/keepalived/nginx-ha-check"
interval 3
weight 50
}
vrrp_instance VI_1 {
interface eth0
state MASTER
@kmjones1979
kmjones1979 / redirect.conf
Created June 5, 2017 20:29
[NGINX Plus] Redirect all HTTP traffic to HTTPS
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
status_zone example.com_80;
location / {
@kmjones1979
kmjones1979 / links.md
Last active March 27, 2017 04:23
ODW 2016 Webinar Links
@kmjones1979
kmjones1979 / lb.conf
Created November 17, 2016 04:55
Example NGINX Plus load balancer configuration - ODW 2016
server {
listen 80;
server_name example.com *.example.com;
status_zone example_com_80;
location / {
proxy_pass http://backend;
}
@kmjones1979
kmjones1979 / backend.conf
Created November 17, 2016 04:53
Example NGINX Plus backend configuration
server {
listen 8001;
listen 8002;
server_name example.com *.example.com;
status_zone backend_800X;
location / {
return 200 "This is a server listening on $server_addr:$server_port \n";
@kmjones1979
kmjones1979 / status.conf
Created November 17, 2016 04:48
Example NGINX status configuration
server {
listen 8080;
server_name localhost example.com *.example.com;
location / {
return 301 /status.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {