Skip to content

Instantly share code, notes, and snippets.

@janzikmund
janzikmund / Postman-pre-request-script-csrf-token-laravel-sanctum.js
Last active July 14, 2025 11:51
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.
@esummers
esummers / Samba Domain Controller.md
Last active November 14, 2024 07:53
Samba Domain Controller on a Raspberry Pi

Running a Samba 4.x Domain Controller on a Raspberry Pi

If you don't have a Windows server available for testing, a Raspberry Pi makes a great test environment. It works with Mac AD Binding, Apple Enterprise Connect, and the Mac Kerberos SSO Extension.

Configuring a Domain Controller on Rasbian or other Debian-based Linux distribution:

  1. Install Rasbian. Use NOOBS if you are new to Raspberry Pi at https://www.raspberrypi.org/downloads/. Optionally enable SSH or VNC support in Raspbian settings menu to remote in to the machine.

  2. Install Samba and related packages. Some packages may launch setup tools. Skip through the Kerberos configuration with defaults. We will be deleting the Kerberos configuration in a later step.

@krisleech
krisleech / renew-gpgkey.md
Last active October 6, 2025 20:21
Renew Expired GPG key

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date:

@treetop1500
treetop1500 / 1. composer.json
Last active January 19, 2022 08:26
Amazon S3 Force Download of Remote File with Symfony (AWS S3 PHP SDK V.3)
{
},
"require": {
"aws/aws-sdk-php": "3.*"
}
}
@mishterk
mishterk / MagnificPopupModal.vue
Last active December 16, 2021 13:15
Magnific Popup component for VueJS. Modified version of https://gist.github.com/antixrist/11f7d78fe680eb3bc15203a940b6b4f8
<template>
<div class="Modal mfp-hide" ref="modal">
<div class="Modal__inner">
<slot></slot>
</div>
</div>
</template>
@JBlond
JBlond / bash-colors.md
Last active November 4, 2025 11:58 — forked from iamnewton/bash-colors.md
The entire table of ANSI color codes.

Regular Colors

Value Color
\e[0;30m Black
\e[0;31m Red
\e[0;32m Green
\e[0;33m Yellow
\e[0;34m Blue
\e[0;35m Purple
@wonderstory
wonderstory / _Flask_.md
Created June 1, 2017 06:09
Flask-uWSGI-nginx on CentOS 7

Small sample of Flask app with uWSGI and nginx on CentOS 7

(Replace example.com, /PATH/TO/CONTENT, APPNAME and USERNAME with yours.)

operations

nginx

$ sudo tee /etc/yum.repos.d/nginx.repo << 'EOF' > /dev/null

[nginx]

@andipaetzold
andipaetzold / dataURLToBlob.js
Created February 19, 2015 14:39
Data URL to Blob in JavaScript
// source: https://github.com/ebidel/filer.js/blob/b7ab6f4cbb82a17565ff68227e5bc984a9934038/src/filer.js#L137-159
var dataURLToBlob = function(dataURL)
{
var BASE64_MARKER = ";base64,";
if (dataURL.indexOf(BASE64_MARKER) == -1)
{
var parts = dataURL.split(",");
var contentType = parts[0].split(":")[1];
var raw = decodeURIComponent(parts[1]);
@codler
codler / gist:3906826
Created October 17, 2012 17:18
Support HTTP Header Range, mp4, php.php/mp4.mp4
<?php
# Nginx don't have PATH_INFO
if (!isset($_SERVER['PATH_INFO'])) {
$_SERVER['PATH_INFO'] = substr($_SERVER["ORIG_SCRIPT_FILENAME"], strlen($_SERVER["SCRIPT_FILENAME"]));
}
$request = substr($_SERVER['PATH_INFO'], 1);
$file = $request;
$fp = @fopen($file, 'rb');