Skip to content

Instantly share code, notes, and snippets.

View pjmagee's full-sized avatar
🏠
Working from home

Patrick Magee pjmagee

🏠
Working from home
View GitHub Profile
@pjmagee
pjmagee / example.d2
Last active February 8, 2025 10:39
D2 Example of API traffic
aws cname: "AWS CNAME" {
description: |md
api.example.com with an imperva dns
|
}
imperva: "WAF" {
description: |md
WAF to protect against bots, attacks
Forward traffic to APIGEE
@pjmagee
pjmagee / sample.cs
Last active January 31, 2025 22:04
Inspector / Suspect Simulation
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.ChatCompletion;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
public class DigitalEvidence
{
public required string Type { get; set; } // SMS, Email, CallLog, GPS, etc.
using System.Net.Http;
using System.Text.Json;
using System.IO;
using System.Collections.Generic;
using System.Threading.Tasks;
// MediaWiki API URL
string wikiApiUrl = "https://www.poe2wiki.net/w/api.php";
string outputDirectory = @"D:\poe2dump\"; // Output directory
@pjmagee
pjmagee / poc-output.cs
Created December 24, 2024 19:17
Roslyn syntax
// This file is generated by DaggerSDK.SourceGenerator
#nullable enable
using System.Text.Json.Serialization;
/// <summary>
/// The `Boolean` scalar type represents `true` or `false`.
/// </summary>
[JsonConverter(typeof(ScalarIdConverter<Boolean>))]
public partial class Boolean : Scalar
{
@pjmagee
pjmagee / init.ps1
Created October 6, 2024 19:26
dagger run pwsh init.ps1
echo "Initializing the GraphQL schema..."
$authHeader = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("${env:DAGGER_SESSION_TOKEN}:"))
dotnet graphql init `
--headers "content-type=application/json" `
--headers "Authorization=Basic $authHeader" `
--clientName DaggerClient `
"http://127.0.0.1:${env:DAGGER_SESSION_PORT}/query"
@pjmagee
pjmagee / extract.go
Last active September 2, 2024 17:05
package main
import (
"context"
"dagger/dsg-icis-openapi-kiota/internal/dagger"
"fmt"
"slices"
)
type Language string
type Fakedeploy struct {
Approved bool
}
func (m *Fakedeploy) WithApproval() (*Fakedeploy, error) {
response, _ := dag.Container().
From("alpine").
WithMountedCache("/tmp/replies", dag.CacheVolume(fmt.Sprintf("reply-%d", time.Now()))).
Terminal(dagger.ContainerTerminalOpts{
2024-07-27 22:07:52,209 - INFO - Making request to https://starwars.fandom.com/api.php?action=parse&page=Aaricetri&format=json&prop=sections%7Cproperties
2024-07-27 22:07:52,427 - INFO - Making request to https://starwars.fandom.com/api.php?action=parse&page=Aaricetri&format=json&prop=categories
2024-07-27 22:07:52,641 - INFO - {
"title": "Aaricetri",
"sections": [
"Overview [ ] Two types of planets existed in the galaxy : gas giants and terrestrial rocky worlds. Moons orbiting gas giants and other rocky worlds were usually not considered planets, even though they could be larger or more populated than other planets. However, Zonama Sekot was considered to be both at different time periods due to its unique mobile nature. Some planets, like Balnab , were still going through stages of organic development Depending on the tilt of its axis, a planet might have had varied seasons with changing temperatures and weather, affecting its habitability. Planets were extremely varied in terms of environmental con
@pjmagee
pjmagee / grid-squares-pages.cs
Created July 22, 2024 18:33
Get all Pages with Galactic Coordinates
class Program
{
private static readonly HttpClient client = new HttpClient();
static async Task Main(string[] args)
{
string category = "Category:Locations_by_grid_square";
List<string> allPages = await GetAllPagesInCategoryAndSubcategories(category);
foreach (string page in allPages)