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 / java_multiple
Last active August 29, 2015 13:57
Java use multi version
alias java_ls='/usr/libexec/java_home -V 2>&1 | grep -E "\d.\d.\d_\d\d" | cut -d , -f 1 | colrm 1 4 | grep -v Home'
function java_use() {
export JAVA_HOME=$(/usr/libexec/java_home -v $1)
export PATH=$JAVA_HOME/bin:$PATH
java -version
}
@xemoe
xemoe / fastalert-mapping.sh
Created May 16, 2014 02:58
Fastalert mapping
#!/bin/bash
curl -XPUT http://localhost:9200/_template/fastalert -d '
{
"template": "fastalert*",
"mappings": {
"fastalert": {
"properties": {
"@timestamp": {
"type": "date"
@xemoe
xemoe / logstash-fast.conf
Created May 16, 2014 03:00
Logstash fastalert-suricata config
input {
file {
path => "/opt/suricata/log/json-archives/*/*"
codec => json
type => "filejson"
start_position => "beginning"
sincedb_path => "/opt/suricata/sincedb/filejson.sincedb"
}
file {
path => "/opt/suricata/log/archives/*/*"
@xemoe
xemoe / .vimrc
Last active August 29, 2015 14:07
Xemoe .vimrc
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'bling/vim-airline'
Plugin 'nathanaelkane/vim-indent-guides'
@xemoe
xemoe / main.sh
Last active December 20, 2021 11:48
Default setup
#!/bin/bash
#######################################################################
##
## START HEADER SCRIPT
##
#######################################################################
type realpath &>/dev/null
if [ $? -eq 1 ]; then
@xemoe
xemoe / blog.conf
Created October 16, 2014 07:38
Nginx sites+alias+rewrite for laravel4
server {
listen 80 default_server;
root /opt/html;
index index.php index.html;
rewrite_log on;
location / {
rewrite ^(/.*?\.php)(/.*)?$ /...$document_root/.../...$1/...$2 last;
}
@xemoe
xemoe / Simple_promise.js
Last active August 29, 2015 14:08
Simple promise
function n() {
var t = this;
t.yet = false;
t.done = function(cb) {
if (!t.yet) {
setTimeout(function(){t.done(cb)}, 1000);
} else {
cb();
}
};
@xemoe
xemoe / curl.php
Last active August 29, 2015 14:10
Curl
class Curl
{
public function download($url, $header = null, $cookie = null, $post = null, $proxy = null) {
$agent = self::generate_useragent();
$tor_address = '127.0.0.1:9050';
$timeout = 300;
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, $header);
@xemoe
xemoe / PHPUnit.md
Last active August 29, 2015 14:11 — forked from slopjong/PHPUnit.md
        $mapperMock = $this->getMock('Doctor\Mapper\Calendar');
        $mapperMock
            ->expects($this->once())
            ->method('getDoctorTimeSlots')
            ->will($this->returnValue([]))
        ;

        $translator = $this->getMock('Zend\Translator');
        $translator
########################
## Software developer ##
## Teerapong ladlee   ##
########################

Teerapong ladlee

Experience & Responsibilities