Skip to content

Instantly share code, notes, and snippets.

View richarddun's full-sized avatar

Richard D richarddun

  • Dublin, Ireland
View GitHub Profile
@richarddun
richarddun / img_vary.py
Created July 6, 2023 14:08
Sample python script to take an image as input and send to dall-e 2 from cli
# This Python file uses the following encoding: utf-8
import openai
import requests
import sys
from PIL import Image
from uuid import uuid4
import os
image_to_vary = sys.argv[1]
try:
@richarddun
richarddun / img_gen.py
Created July 6, 2023 14:03
Basic OpenAI image gen (Dall-e 2) from cli using python
# This Python file uses the following encoding: utf-8
import openai
import requests
import sys
from PIL import Image
# sample usage of Dalle-2 via Python
# from CLI with sys for args
variations = 4
@richarddun
richarddun / aiohttp_sample
Last active September 1, 2017 19:24
Sample usage of aiohttp to post arbitary data and return / use the result in original order with asyncio.gather()
import asyncio
import aiohttp
import json
async def retrieve_data(postdata):
async with aiohttp.ClientSession() as client:
#use the excellent httpbin.org as a springboard
postrep = await client.post('http://httpbin.org/post',data={"postkey":postdata})
jsonobj = json.loads(await postrep.text())
return jsonobj['form']['postkey']
@richarddun
richarddun / gist:1bb11d32cafc394efbcb8f4a8b6cb130
Last active April 23, 2024 14:22
scapy script to send http requests
#!/usr/bin/env python
"""
Script to open TCP connection and send 1 HTTP GET request containing
a specific string, and header
Usage:
./http.py <IP_of_target>
There is only one mandatory argument, which is the target IP address.
#!/usr/bin/env python2
import curses
import curses.panel
def main(win):
global stdscr
global max_y,max_x,mult
stdscr = win
curses.initscr()