Skip to content

Instantly share code, notes, and snippets.

@edwardyi
edwardyi / BatchBase.php
Last active May 14, 2022 00:46
BatchBase crud for laravel
<?php
namespace App\Traits\Service\Batch;
use App\Traits\Repository\Collectable;
use App\Validate\UtilDate;
use App\Exceptions\Batch\{ItemIdNotFoundException, ItemIdMissingException};
use Exception;
use Illuminate\Support\{Arr, Collection};
@edwardyi
edwardyi / useHexo.md
Created February 12, 2019 07:32 — forked from btfak/useHexo.md
How to use Hexo and deploy to GitHub Pages
@edwardyi
edwardyi / gist:88d2772df5b85e208f42473e75d09a50
Last active February 12, 2019 07:04
Java ArrayList vs Integer Array
// 沒有加會有小紅線提示
import java.util.ArrayList;
public class Test{
public static void test1{
int[] arr = new int[10];
arr[0] = 2;
arr[1] = 3;
for(int i=0; i< arr.length; i++){
System.out.println(arr[i]);
// https://www.bilibili.com/video/av9982752/?spm_id_from=333.788.videocard.1
#include <stdio.h>
void merge(int arr[], int L, int M, int R) {
int LEFT_SIZE = M-L;
int RIGHT_SIZE = R-M+1;
int left[LEFT_SIZE];
int right[RIGHT_SIZE];
int i,j,k;
@edwardyi
edwardyi / nginx-tuning.md
Created October 31, 2018 10:24 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@edwardyi
edwardyi / install_scala_sbt.sh
Created February 2, 2018 03:56 — forked from visenger/install_scala_sbt.sh
Scala and sbt installation on ubuntu 12.04
#!/bin/sh
# one way (older scala version will be installed)
# sudo apt-get install scala
#2nd way
sudo apt-get remove scala-library scala
wget http://www.scala-lang.org/files/archive/scala-2.11.4.deb
sudo dpkg -i scala-2.11.4.deb
sudo apt-get update