Skip to content

Instantly share code, notes, and snippets.

View Krewn's full-sized avatar

Kevin Nelson Krewn

View GitHub Profile
@Krewn
Krewn / openAiDalleInterface.py
Created January 4, 2023 18:44
You will need to set your OPENAI_API_KEY system environmental variable for this to work for you.
#importing needed libraries
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
from pyramid.view import view_config
import openai
import json
#creating a data structure for our application
responses = []
@Krewn
Krewn / pyramidWebDemo.py
Last active November 11, 2022 20:39
A basic pyramid webserver for submitting querys to methods.
import os
from urllib import parse
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
from pyramid.view import view_config
class boilerPlate:
@Krewn
Krewn / cap.go
Last active November 17, 2022 18:08
This is a webserver for generating query strings with low hashes, and redirect to http://aHashPlace.herokuapp.com. goCap.py takes an x y image and scale and makes requests to cap.go. runner.py spins up 2 instances of cap.go and 2 instances of goCap.py the second instance will proceed backwards through the pixels in reverse.
package main
import(
"bytes"
"fmt"
"crypto/sha256"
"math/rand"
"time"
"net/http"
@Krewn
Krewn / aHashPlaceImgDrawer.py
Last active October 25, 2022 23:49
Sorry for the default image download. Feel free to make modifications before use... Obviously.
from urllib import parse
import requests
from bs4 import BeautifulSoup
import hashlib
import sys
from PIL import Image
import shutil
def findFlavor(attrs):
@Krewn
Krewn / cap.py
Last active October 25, 2022 21:04
A bot for mining pixels on aHashPlace
import hashlib
from urllib import parse
import webcolors
from PIL import Image
import os
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
from pyramid.view import view_config
@Krewn
Krewn / HashPlace.py
Last active October 24, 2022 15:11
Like r/place but it's proof of work.
import hashlib
from urllib import parse
import webcolors
from PIL import Image
import os
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
from pyramid.view import view_config
@Krewn
Krewn / demo.py
Created September 29, 2022 21:44
Implementation of semi random motion in 2 dimensions.
import pygame
import math
import time
import drunk
import random
width=1000
height=1000
padding = 10
@Krewn
Krewn / clockScatter.py
Last active May 28, 2022 17:36
Scatter plot of method calls performed vs. clock ticks.
import os
import time
import matplotlib.pyplot as plt
import numpy as np
import random
import mplcursors
def randHex(length,psudo=False):
if psudo:
@Krewn
Krewn / ClockTicksHisto.py
Last active March 28, 2022 16:21
This makes a histogram of clock tick durations.
import time
import matplotlib.pyplot as plt
import math
class buckets:
def __init__(self):
self.data = {}
def count(self,bucket):
try:
self.data[bucket]+=1
@Krewn
Krewn / differ.go
Last active March 27, 2022 14:11
Uses SHA256 hash sums to determine which files change.
package main
import(
"fmt"
"io/ioutil"
"log"
"strings"
"os"
)