Skip to content

Instantly share code, notes, and snippets.

View muchrm's full-sized avatar
😃

Pongpanot Chuaysakun muchrm

😃
  • LINE THAILAND
  • Thailand
  • 18:03 (UTC +07:00)
View GitHub Profile
@muchrm
muchrm / docker-compose.yml
Created April 28, 2018 09:10 — forked from winggundamth/docker-compose.yml
Elasticsearch Cluster + Grafana Docker Compose File
version: '3'
services:
es1:
image: docker.elastic.co/elasticsearch/elasticsearch:6.2.4
container_name: es1
environment:
cluster.name: "docker-cluster"
bootstrap.memory_lock: "true"
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
TAKE_FILE_OWNERSHIP: "true"
const mongoose = require('mongoose');
const Promise = require('bluebird');
var url = 'mongodb://10.80.6.49:27017/test';
mongoose.connect(url);
mongoose.connection.on('error', (err) => {
console.error(`MongoDB connection error: ${err}`);
process.exit(-1);
@muchrm
muchrm / basic-docker-mongo.md
Last active February 25, 2018 14:37
basic docker mongo

เริ่มใช้งาน

docker run -it --name mongo -p 27017:27017 -d mongo

เลิกใช้งาน

docker stop mongo

การกลับมาใช้งานอีกครั้ง

docker start mongo

ลบทิ้ง

docker container rm -f mongo

<?php
namespace App\Traits;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Config;
trait FindPeriodFromDateTraite
{
private function findPeriodFromDate(Carbon $date)
{
@muchrm
muchrm / ResearchResultFilterYearCriteria.php
Created February 6, 2018 07:03
Research Result Filter Year Criteria
<?php
namespace App\Criteria;
use Prettus\Repository\Contracts\CriteriaInterface;
use Prettus\Repository\Contracts\RepositoryInterface;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Carbon;
/**
@muchrm
muchrm / vibie.play
Created January 17, 2018 16:50 — forked from narate/vibie.play
ffplay live from vibie.live required ffmpeg --with-ffplay and jq
#!/bin/bash
LIVE_DATA=$(curl -s "$1" | grep __NEXT_DATA__ | sed 's/__NEXT_DATA__ =//g')
STATUS=$(echo $LIVE_DATA | jq '.props.live.status' | sed 's/"//g')
if [ $STATUS == "inactive" ]
then
echo "ERROR: live status is $STATUS"
exit -1
fi
##cloud Hosted
socket.io
pusher.com
Faye https://github.com/faye/faye
Scaledrone https://www.scaledrone.com
Ably: https://www.ably.io
Contus Fly
Fanout: http://fanout.io/
Firebase https://www.firebase.com
Gamooga: http://www.gamooga.com/
usort($courses, function($a, $b) {
$vala = $a['courseCode'];
$valb = $b['courseCode'];
if($vala >= 1000000){
$vala = intval($vala/100);
}
if($valb >= 1000000){
$valb = intval($valb/100);
}
if($vala < $valb){
@muchrm
muchrm / global-state.enum.ts
Last active May 21, 2021 16:34
Simple Global State
export enum GlobalState {
Layout = 1,
User = 3,
MaxColumn = 5
}
import * as request from 'request-promise';
export class Kong {
constructor(
private readonly baseUrl,
) { }
get(path) {
return this.request('GET', path);
}
post(path, body) {