This is a simple example to do a "multipart/form-data" POST request in PHP without any fancy library.
This file contains hidden or 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
| # | |
| # Apple SuperDrive initialization rule | |
| # | |
| # See: https://gist.github.com/yookoala/818c1ff057e3d965980b7fd3bf8f77a6 | |
| ACTION=="add", ATTRS{idProduct}=="1500", ATTRS{idVendor}=="05ac", DRIVERS=="usb", RUN+="/usr/bin/sg_raw --cmdset=1 %r/sr%n EA 00 00 00 00 00 01" |
This file contains hidden or 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
| # API Key | |
| MISTRAL_API_KEY="some-api-key" | |
| # Model used | |
| #MISTRAL_MODEL="mistral-large-latest" | |
| MISTRAL_MODEL="mistral-tiny" |
This file contains hidden or 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
| <?php | |
| /** | |
| * Build HTML tag attributes string with a given array. | |
| * | |
| * Usage Example: | |
| * echo '<img ' . http_build_attributes([ | |
| * 'src' => 'some-image-url', | |
| * 'class' => ['img-responsive', 'decorative'], | |
| * ]); |
This file contains hidden or 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/bash | |
| # | |
| # Drush launcher no longer works in Druapl 10 because of | |
| # the TTY check in the new Symfony's Process implementation. | |
| # | |
| # This script search for a "vendor/bin/drush" in the current | |
| # folder herichey and proxy parameters to that drush. Feels | |
| # like old launcher behaviour. | |
| # |
These files are for testing golang's concurrent writing to the same connection (net.Conn), specifically through a unix socket. To see if concurrent use of net.Conn would lead to contemination of data beting sent.
The file client.go will is program to send multiple data stream of repeated characters to the
unix socket "./echo.sock". The number of streams is declared by the arguments of the client.go
This file contains hidden or 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
| <?php | |
| $method = $_SERVER['REQUEST_METHOD'] ?? null; | |
| if ($method === 'POST') { | |
| $content_type = preg_match('/^(.+?); (.+?)$/', $_SERVER['HTTP_CONTENT_TYPE'] ?? '', $matches) | |
| ? $matches[1] | |
| : ($_SERVER['HTTP_CONTENT_TYPE'] ?? null); | |
| // Parse input data by content type | |
| $input = file_get_contents('php://input'); |
This file contains hidden or 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
| <?php | |
| /** | |
| * http_parse_response_header() | |
| * Parse $http_response_header produced by file_get_contents(). | |
| * | |
| * @param array $header | |
| * Supposed $http_response_header or array alike. | |
| * @param array | |
| * Assoc array of the parsed version. |
This file contains hidden or 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/bash | |
| # A collection of high-level-ish functions for | |
| # bash pipeline operations. | |
| # breakdown the output of ls or find into one | |
| # item per line in STDOUT for pipeline. | |
| # | |
| # Usage: | |
| # ls . | breakdown |
This file contains hidden or 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
| <?php | |
| /** | |
| * Extract HTML children of a give tag name from a given document. | |
| * | |
| * @param \DOMDocument $doc The DOM document to extract from. | |
| * @param string $tagName The tag name for extraction (e.g. 'head', 'body') | |
| * | |
| * @return \DOMDocument An DOMElement containing all child elements from the tag specified in $dom. | |
| */ |
NewerOlder