# create python virtual environment
python -m venv ghost
source ./ghost/bin/activate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ForwardedHeadersMiddleware : OwinMiddleware | |
{ | |
public ForwardedHeadersMiddleware(OwinMiddleware next) : base(next) | |
{ | |
} | |
public override Task Invoke(IOwinContext context) | |
{ | |
if (string.Equals(context.Request.Headers["X-Forwarded-Proto"], "https", | |
StringComparison.OrdinalIgnoreCase)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/colinmollenhour/docker-openmage/blob/main/8.2/apache/Dockerfile | |
# https://github.com/OpenMage/magento-lts/tree/main/dev/openmage | |
ARG PHP_VERSION=8.2 | |
ARG OPENMAGE_VERSION=20.3.0 | |
FROM alpine as unzipper | |
ARG OPENMAGE_VERSION | |
RUN set -eux; \ | |
apk add curl unzip; \ | |
mkdir -p /usr/src/openmage; \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Reflection; | |
namespace System.Text.Json.Serialization; | |
/// https://learn.microsoft.com/dotnet/standard/serialization/system-text-json/converters-how-to | |
public class ListOfEnumStringConverter : JsonConverterFactory | |
{ | |
public override bool CanConvert(Type typeToConvert) | |
{ | |
if (!typeToConvert.IsGenericType) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// see alternative tool at https://www.npmjs.com/package/reqon | |
const http = require('http'); | |
const port = process.argv[2] || 3000; | |
const server = http.createServer((req, res) => { | |
console.log('--- ', new Date().toISOString()); | |
console.log(req.method, req.url); | |
for (let header in req.headers) { | |
console.log(`${header}: ${req.headers[header]}`); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
# encoding: utf-8 | |
""" | |
This is a small python script to clear up old gitlab build artifacts. | |
""" | |
import argparse | |
import datetime | |
import functools | |
import json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Origin: https://github.com/inderpreet99/protoaculous-bundler | |
# Requirements: curl,unzip,perl,npx | |
PROTOTYPE_VER="1.7.3.0" | |
SCRIPTACULOUS_VER="1.9.0" | |
[ -f "prototype.$PROTOTYPE_VER.js" ] || curl -so prototype.$PROTOTYPE_VER.js https://ajax.googleapis.com/ajax/libs/prototype/$PROTOTYPE_VER/prototype.js | |
[ -f "scriptaculous-js-$SCRIPTACULOUS_VER.zip" ] || curl -sO http://script.aculo.us/dist/scriptaculous-js-$SCRIPTACULOUS_VER.zip | |
unzip -q -o scriptaculous-js-$SCRIPTACULOUS_VER.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Net.NetworkInformation; | |
using System.Net.Sockets; | |
using Microsoft.AspNetCore.Http.Extensions; | |
var builder = WebApplication.CreateBuilder(args); | |
var app = builder.Build(); | |
app.Map("/", async (HttpRequest request, HttpResponse response) => | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- The following configuration should also work with Azure App Service --> | |
<configuration> | |
<system.web> | |
<!-- Disable X-AspNet-Version Header --> | |
<httpRuntime enableVersionHeader="false" /> | |
<!-- File upload size limit (KB), avoid DoS attack --> | |
<httpRuntime maxRequestLength="4096" /> | |
<!-- Disable debug & trace in Production --> | |
<compilation debug="false" /> | |
<trace enabled="false" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Reflection; | |
using Microsoft.AspNetCore.Http; | |
public class MiddlewareDiagnosticObserver : IObserver<KeyValuePair<string,object?>> | |
{ | |
public void OnCompleted() | |
{ | |
// Do nothing |
NewerOlder