Skip to content

Instantly share code, notes, and snippets.

View xemoe's full-sized avatar
🏠
Working from home

Teerapong Ladlee xemoe

🏠
Working from home
  • Bangkok, Thailand
View GitHub Profile
@xemoe
xemoe / psr_2.4_th.md
Last active August 29, 2015 14:23
PSR 2.4
  1. Classes, Properties, and Methods

ในข้อกำหนด คลาส หมายรวมถึงคำสำคัญ class, interface และ traits

4.1. การสืบทอด (Extends) และการนำไปใช้ (Implements)

การประกาศใช้ extends และ implements ต้องอยู่ในบรรทัดเดียวกับชื่อคลาส

การเปิดปีกกาของคลาสต้องวางในบรรทัดต่อจากการประกาศชื่อคลาสและปิดปีกกาในบรรทัดต่อจากโค้ดภายในคลาสนั้น

@xemoe
xemoe / curl_pretty_json.md
Created June 25, 2015 06:56
Curl pretty json
curl 'http://127.0.0.1:9200/_all/_stats/' | python -m json.tool
@xemoe
xemoe / logstash_develop.md
Last active January 18, 2017 10:34
Logstash development

Preconfigure ** Important ***

  1. Install rvm https://rvm.io/

  2. Install jruby

    rvm install jruby
  3. use jruby

@xemoe
xemoe / real_network_interface_card.md
Created June 29, 2015 15:43
Get physical network interface
find /sys/class/net -type l|xargs readlink -f|grep -v virtual|xargs -n1 -d '\n' basename
@xemoe
xemoe / palindrome.php
Last active August 29, 2015 14:25
Palindrome
<?php
//
// Testing on:
// PHP 5.6.10-1+deb.sury.org~vivid+1 (cli)
//
function palindrome($string)
{
ksort($counter = count_chars($string, 1));
$ret = '';
@xemoe
xemoe / php_array_nested.php
Last active August 29, 2015 14:25
PHP Array nested get/set
<?php
function array_bags($keys, $root, $bags)
{
$key = array_shift($keys);
$root = $root[$key];
$bags[] = ['key' => $key, 'root' => $root];
$length = sizeof($keys);
@xemoe
xemoe / influxdb_setup.md
Created August 3, 2015 15:07
Metric setup

For Ubuntu 14.04

Download dpkg file

wget https://s3.amazonaws.com/influxdb/influxdb_0.9.2_amd64.deb 
sudo dpkg -i influxdb_0.9.2_amd64.deb

Generate influxdb configuration

/opt/influxdb/influxd config > /opt/influxdb/influxdb.conf

@xemoe
xemoe / remove_old_kernel.md
Created August 11, 2015 05:19
Remove old kernel
sudo apt-get remove --purge $(dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d')
@xemoe
xemoe / php_command_templates.php
Created September 17, 2015 07:08
PHP Command template
<?php
$configuration = ['eth0' => ['ip_address' => '192.168.1.100', 'netmask' => '255.255.255.0', 'gateway_ip_address' => '192.168.1.1', 'interface' => 'eth0']];
$template = [
'template' => 'ip addr add %s dev %s',
'variables' => ['ip_address', 'interface'],
];
function build($configuration, $template)
{
@xemoe
xemoe / data_analysis.md
Last active October 7, 2015 10:11
Getting started with Data analysis

Data analysis basic summary

Getting started with Data analysis

การวิเคราะห์ข้อมูลดิบ ทำการจัดเรียงลำดับหรือจัดหมวดหมู่ เพื่ออธิบายสิ่งที่เกิดขึ้นในอดีตและทำนายสิ่งที่จะเกิดขึ้นในอนาคต โดยไม่ได้หมายถึงเฉพาะตัวเลข แต่เป็นการสร้างและตั้งคำถาม การพัฒนาและสร้างคำอธิบาย นิยามของข้อสันนิษฐานหรือเหตุการณ์ที่เกิดขึ้น

ทั้งนี้จำเป็นต้องอาศัยองค์ความรู้หลายแขนงด้วยกันเช่น

computer science