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 / authen_acl_recipes.md
Last active August 29, 2015 14:18
User authentication & authorized

Testcase

Authentication

  1. Guest can access login form and see form
  2. Guest cannot access forbidden area and redirect to login form
  3. Customer user can login and see logout link

Authorized

  1. Logged in user can access profile page
  2. Customer role cannot access admin form
  3. Admin role can access admin form
@xemoe
xemoe / start.sh
Last active August 29, 2015 14:14
Kylemanna/docker-openvpn helper script
#!/bin/bash
#################################
## Boostrap and Initial parameters
#################################
# Require realpath
type realpath;
if [ $? -eq 1 ]; then
echo "realpath command not found, wait for install"
sudo apt-get update && sudo apt-get install realpath -y;
########################
## Software developer ##
## Teerapong ladlee   ##
########################

Teerapong ladlee

Experience & Responsibilities

@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
@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 / 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 / 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 / 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 / .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 / 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/*/*"