Skip to content

Instantly share code, notes, and snippets.

Masashi Shinbara shin1x1

View GitHub Profile
View wake.go
package main
import (
"fmt"
"log"
"os"
"os/exec"
"sync"
"time"
)
View counter.ts
console.log('counter loading...');
const counter = {
no: 0
};
export default counter;
View TransferMoney.php
<?php
declare(strict_types=1);
namespace Acme\Account\UseCases;
use Acme\Account\Models\Account;
use Acme\Account\Models\AccountNumber;
use Acme\Account\Models\Money;
final class TransferMoney
@shin1x1
shin1x1 / build_curl.sh
Created Feb 23, 2018
Build curl with openssl in CentOS/RHEL/Amazon Linux
View build_curl.sh
#!/bin/sh
set -eux
VERSION=7.58.0
OUTPUT=/opt/build
rm -rf ${OUTPUT}
mkdir ${OUTPUT}
yum install -y openssl-devel gcc bzip2 make
@shin1x1
shin1x1 / file0.go
Created Jan 25, 2018
Echo で HTTP リクエストヘッダをミドルウェアでダンプする ref: https://qiita.com/shin1x1/items/cfe7568cecbaffe0b23c
View file0.go
package main
import (
"github.com/labstack/echo"
"fmt"
"log"
"os"
)
func main() {
View composer.json
{
"require": {
"php": ">=5.6.4",
"cakephp/chronos": "^1.1",
"goodby/csv": "^1.3",
"laravel/framework": "5.4.*",
"laravel/tinker": "~1.0",
"laravelcollective/html": "^5.4",
"rollbar/rollbar": "^1.2",
"s-ichikawa/laravel-sendgrid-driver": "^1.2"
View typehint.php
<?php
const LOOP = 1000000;
$bench = function (string $label, callable $func) {
$s = microtime(true);
for ($i = 0 ; $i < LOOP ; $i++) {
$func(1, 2);
}
echo '=== ' . $label, PHP_EOL;
echo (microtime(true) - $s), PHP_EOL;
View a.md
current -> releases/20170409123456
releases/
  20170407100000/
  20170409091001/
  20170409123456/
shared/
View non-blocking-http-client.php
<?php
const HOST = '49.212.25.40';
const PORT = '80';
function createStream() {
$errorNo = $errorMessage = null;
$stream = stream_socket_client(HOST . ':' . PORT, $errorNo, $errorMessage, 10);
if (!$stream) {
throw new \Exception($errorNo . ':', $errorMessage);
}
You can’t perform that action at this time.