Skip to content

Instantly share code, notes, and snippets.

View sadiqsalau's full-sized avatar
💻
Coding

Sadiq Salau sadiqsalau

💻
Coding
View GitHub Profile
@anishghimire862
anishghimire862 / brotli_nginx
Last active May 6, 2025 11:28
Enabling Brotli Compression on existing NGINX web server on Ubuntu 22.04
1) SSH into the server as a root user
2) Install the required dependencies. Run apt install cmake libpcre3 libpcre3-dev
3) Run wget "https://nginx.org/download/nginx-$(nginx -v 2>&1 | awk -F/ '{print $2}' | sed 's/(Ubuntu)//' | tr -d '[:space:]').tar.gz"
4) Run tar -xzf nginx-{{ version }}.tar.gz
5) Run git clone --recurse-submodules -j8 https://github.com/google/ngx_brotli
6) cd ngx_brotli/deps/brotli && mkdir out && cd out
7) Run cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS="-Ofast -m64 -march=native -mtune=native -flto -funroll-loops -ffunction-sections -fdata-sections -Wl,--gc-sections" -DCMAKE_CXX_FLAGS="-Ofast -m64 -march=native -mtune=native -flto -funroll-loops -ffunction-sections -fdata-sections -Wl,--gc-sections" -DCMAKE_INSTALL_PREFIX=./installed ..
8) Run cmake --build . --config Release --target brotlienc
9) Run cd ~/nginx-{{ version }}
10) Run ./configure --add-module=/root/ngx_brotli
@sadiqsalau
sadiqsalau / README.md
Last active April 1, 2024 17:48
Thunder Client Laravel CSRF
  1. Open thunder client, switch to Env and create a local environment.
  2. Add a test to your collection by navigating to the Tests tab, then select Set Env Variable, set query to cookie.xsrf-token and value to {{XSRF-TOKEN, local}}
  3. In the Headers tab, add an header named X-XSRF-TOKEN with value {{XSRF-TOKEN | urlDecode}}.
  4. Create a request to /sanctum/csrf-cookie to refresh CSRF Token if it expires
@FbN
FbN / vite.config.js
Last active April 6, 2025 13:31
vite.config.js node built-in polyfills
// yarn add --dev @esbuild-plugins/node-globals-polyfill
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill'
// yarn add --dev @esbuild-plugins/node-modules-polyfill
import { NodeModulesPolyfillPlugin } from '@esbuild-plugins/node-modules-polyfill'
// You don't need to add this to deps, it's included by @esbuild-plugins/node-modules-polyfill
import rollupNodePolyFill from 'rollup-plugin-node-polyfills'
export default {
resolve: {
alias: {
@janzikmund
janzikmund / Postman-pre-request-script-csrf-token-laravel-sanctum.js
Last active October 25, 2024 17:52
Postman Pre-Request script to append CSRF token in header for POST requests in Laravel Sanctum authenticated SPA. Requires active environment with {{url}} variable defined for main app domain.
/**
* Postman Pre-Request script to append CSRF token in header for POST requests in Laravel
* Sanctum authenticated SPA. Requires active environment with {{url}} variable defined
* for main app domain.
*
* Postman Interceptor allows appending cookies from browser, but Laravel CSRF middleware
* only validates CSRF in headers or in _token form field, not in cookies. Axios automatically
* appends the CSRF from cookie to headers, but Postman cannot access intercepted cookies
* and use them, so we have to do one pre-request to get the CSRF token, store it
* in environment so it can be reused, and then append it to headers.