Skip to content

Instantly share code, notes, and snippets.

View christian-korneck's full-sized avatar
💭
I may be slow to respond.

Christian Korneck christian-korneck

💭
I may be slow to respond.
View GitHub Profile
@omenos
omenos / ChatGPT-4o.md
Last active April 7, 2025 03:05
Using AI models to generate Terraform configurations

Here's a Terraform configuration using the oracle/oci provider (version ~> 6.0) that provisions a virtual server in Oracle Cloud Infrastructure (OCI) with the specified requirements:

Terraform Configuration

terraform {
  required_providers {
    oci = {
      source  = "oracle/oci"
      version = "~> 6.0"
@jwbee
jwbee / jq.md
Last active April 27, 2025 11:31
Make Ubuntu packages 90% faster by rebuilding them

Make Ubuntu packages 90% faster by rebuilding them

TL;DR

You can take the same source code package that Ubuntu uses to build jq, compile it again, and realize 90% better performance.

Setting

I use jq for processing GeoJSON files and other open data offered in JSON format. Today I am working with a 500MB GeoJSON file that contains the Alameda County Assessor's parcel map. I want to run a query that prints the city for every parcel worth more than a threshold amount. The program is

@amouat
amouat / fortify.c
Last active January 10, 2025 09:02
Exercising _FORTIFY_SOURCE in gcc (clang should work as well)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/*
* Simple test program for FORTIFY_SOURCE.
*
* Compile with the following to test with no source fortification and stack protection off:
* gcc -D_FORTIFY_SOURCE=0 -fno-stack-protector fortify.c -o fortify
*
@jborean93
jborean93 / PwshPipeServer.cs
Created December 10, 2024 06:25
Code to run a PowerShell named pipe server as a Task
using System;
using System.Management.Automation.Remoting;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
#nullable enable
/*
This code uses internal APIs of the PowerShell remoting system to create the
@kyleavery
kyleavery / pdf_to_md.py
Created December 1, 2024 23:53
PDF to Markdown
import os
import base64
from concurrent.futures import ThreadPoolExecutor, as_completed
import openai
from pdf2image import convert_from_path
from PIL import Image
@antonputra
antonputra / gist:533fdd507f797cc30b082eed2c4f6fb4
Created August 23, 2024 20:22
Golang Dockerfile with upx
FROM golang:1.23.0-bookworm AS build
ARG upx_version=4.2.4
RUN apt-get update && apt-get install -y --no-install-recommends xz-utils && \
curl -Ls https://github.com/upx/upx/releases/download/v${upx_version}/upx-${upx_version}-amd64_linux.tar.xz -o - | tar xvJf - -C /tmp && \
cp /tmp/upx-${upx_version}-amd64_linux/upx /usr/local/bin/ && \
chmod +x /usr/local/bin/upx && \
apt-get remove -y xz-utils && \
rm -rf /var/lib/apt/lists/*
@jborean93
jborean93 / New-ScheduledTaskSession.ps1
Last active April 7, 2025 18:56
Creates a PSSession that targets a scheduled task process
# Copyright: (c) 2024, Jordan Borean (@jborean93) <[email protected]>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
Function New-ScheduledTaskSession {
<#
.SYNOPSIS
Creates a PSSession for a process running as a scheduled task.
.DESCRIPTION
Creates a PSSession that can be used to run code inside a scheduled task

Optimizing Django and Celery for Handling Many Concurrent Requests

Handling a high volume of concurrent requests in a Django application with Celery for background tasks can be challenging. This guide will walk you through the necessary steps to optimize your setup for better performance and scalability.

Default Setup with Gunicorn and Celery

By default, Gunicorn with Django and Celery uses synchronous workers to handle web requests and background tasks. This means:

  • Gunicorn: Uses sync workers which can handle one request at a time per worker.
  • Celery: Processes tasks synchronously within each worker.
function Write-CustomLog {
param([string]$Message)
$callerInfo = (Get-PSCallStack)[1]
$scriptName = Split-Path -Leaf $callerInfo.ScriptName
$lineNumber = $callerInfo.ScriptLineNumber
$functionName = $callerInfo.FunctionName
$logEntry = "{0:yyyy-MM-dd HH:mm:ss} - {1}:{2} - {3} - {4}" -f `
(Get-Date), $scriptName, $lineNumber, $functionName, $Message
@allyford
allyford / README.md
Last active July 5, 2024 16:14
Enable Windows Exporter on AKS (Preview)

Enable Windows Exporter on AKS (Private Preview)

AKS preview features are available on a self-service, opt-in basis. Previews are provided "as is" and "as available," and they're excluded from the service-level agreements and limited warranty. AKS previews are partially covered by customer support on a best-effort basis. As such, these features aren't meant for production use. For more information, see the following support articles:

AKS support policies

Azure support FAQ

What is Windows Exporter?