This is a simple example to do a "multipart/form-data" POST request in PHP without any fancy library.
This file contains 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 | |
BASENAME=$(basename $0) | |
BASEPATH=$(dirname $(realpath $0)) | |
# Print usage message | |
function usage { | |
cat <<EOF | |
usage: $BASENAME -k <GITHUB_API_TOKEN> -r <GITHUB_REPO_SLUG> -t <TAG> <DIST_PATH> <LABEL> |
This file contains 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 | |
/** | |
* @file | |
* | |
* Mock Sendmail | |
* | |
* A small script to be used as sendmail for debugging mailing functions in php. | |
* | |
* Usage: |
This file contains 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 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 | |
namespace Monogatari\RemoteStorage; | |
/** | |
* Throw this if a key is not found in a StorageInterface. | |
*/ | |
class StorageKeyNotFound extends \Exception | |
{ | |
/** |
This file contains 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
class DummyParent { | |
static hello() { | |
console.log('dummy parent say hello') | |
} | |
} | |
class Dummy extends DummyParent { | |
static foo() { | |
console.log('dummy say foo') | |
} |
This file contains 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
# | |
# Save this file as: /etc/systemd/system/battery-level-check.service | |
# | |
[Unit] | |
Description=Battery check. If higher than 80% or lower than 40%, notify desktop user | |
Wants=battery-level-check.timer | |
[Service] | |
Type=simple |
This file contains 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. | |
*/ |
This file contains 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'); |
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