Skip to content

Instantly share code, notes, and snippets.

🐶
Tada

Nyan Win pyaesone17

🐶
Tada
Block or report user

Report or block pyaesone17

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:0380ffa458741ce195e17ab361bb5709
f, err := os.OpenFile("bar.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
log.Fatalf("error opening file: %v", err)
}
defer f.Close()
mw := io.MultiWriter(os.Stdout, f)
log.SetOutput(mw)
@pyaesone17
pyaesone17 / 1_kubernetes_on_macOS.md
Created Jul 10, 2018 — forked from kevin-smets/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry
View 1_kubernetes_on_macOS.md

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

@pyaesone17
pyaesone17 / .php
Created Feb 7, 2018
route for queue
View .php
<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
View .php
<?php
namespace App\Jobs;
use App\User;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
View gist:d5ab9356b0252575867bb74aa297ed22
<?php
class LogManager {
protected $logger;
public function __construct($logger) {
$this->logger = $loggervar;
}
public function log($msg, $level)
{
View chunk get file
function file_get_contents_chunked($file,$chunk_size,$callback)
{
try
{
$handle = fopen($file, "r");
$i = 0;
while (!feof($handle))
{
call_user_func_array($callback,array(fread($handle,$chunk_size),&$handle,$i));
$i++;
@pyaesone17
pyaesone17 / composition.php
Created Nov 26, 2017
Go lang struct composition implementation in PHP
View composition.php
<?php
class A {
public $dependencies = [];
public function __construct(...$arguments)
{
$this->dependencies = $arguments;
}
You can’t perform that action at this time.