Skip to content

Instantly share code, notes, and snippets.

@sttuartt
sttuartt / graphql.json
Last active September 18, 2023 09:16
graphql introspection query
{"query":
"query IntrospectionQuery {\n __schema {\n queryType {\n name\n }\n mutationType {\n name\n }\n subscriptionType {\n name\n }\n types {\n ...FullType\n }\n directives {\n name\n description\n args {\n ...InputValue\n }\n }\n }\n}\n\nfragment FullType on __Type {\n kind\n name\n description\n fields(includeDeprecated: true) {\n name\n description\n args {\n ...InputValue\n }\n type {\n ...TypeRef\n }\n isDeprecated\n deprecationReason\n }\n inputFields {\n ...InputValue\n }\n interfaces {\n ...TypeRef\n }\n enumValues(includeDeprecated: true) {\n name\n description\n isDeprecated\n deprecationReason\n }\n possibleTypes {\n ...TypeRef\n }\n}\n\nfragment InputValue on __InputValue {\n name\n description\n type {\n ...TypeRef\n }\n defaultValue\n}\n\nfragment TypeRef on __Type {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind
@sttuartt
sttuartt / chatgpt_online_quiz.md
Last active September 25, 2023 07:18
Chatgpt prompt for online quiz content creation

Generate online quiz

Overview

Using transcript/subtitles from online course, use Chatgpt to create a multiple choice quiz and output in json format. Save this output in separate file/s. Then use a second script to process these json file/s in order to generate html file/s that present the quiz nicely, and hide the correct answer for each question. Lastly, open all html files in a new browser and simply navigate from tab to tab to test yourself.

I used this to generate a quiz for all content from the A Cloud Guru course for DevOps Engineer - use this tool to download all files (including .srt files, which is what is relevant here). I set the quality to 480 as I didn't care about the videos, just the transcripts.

Notes

This was developed on, and for use with a mac, so some adjustment may be necessary for use on other operating systems.

Assumptions

http request smuggler extension

description

This file captures the relevant parts of the requests generated by the http request smuggler burp suite extension.

The extension's dialog box has a large number of checkboxes, but it is not clear by looking at it, what some/most of these do.

Hopefully this will provide some insight as to what requests are actually being sent as a result of the selected tests.

@sttuartt
sttuartt / js-endpoints
Last active November 11, 2024 08:37
js-endpoints
javascript:(function(){var scripts=document.getElementsByTagName("script"),regex=/(?<=(\"|\'|\`))\/[a-zA-Z0-9_?&=\/\-\#\.]*(?=(\"|\'|\`))/g,results=new Set;Promise.all(Array.from(scripts).map(script=>{var src=script.src;if(src){return fetch(src).then(response=>response.text()).then(content=>{var matches=content.matchAll(regex);for(let match of matches){results.add(src+": "+match[0])}}).catch(error=>{console.log("An error occurred: ",error)})}})).then(()=>{var pageContent=document.documentElement.outerHTML,matches=pageContent.matchAll(regex);for(const match of matches){results.add("HTML Content: "+match[0])}writeResults()});function writeResults(){let sortedResults=[...results].sort((a,b)=>{if(a.startsWith("HTML Content:")&&b.startsWith("HTML Content:")) return a.localeCompare(b);if(a.startsWith("HTML Content:")) return -1;if(b.startsWith("HTML Content:")) return 1;return a.localeCompare(b)});sortedResults.forEach(result=>{document.write(result+"<br>")})}})();