Skip to content

Instantly share code, notes, and snippets.

View ball6847's full-sized avatar
🎯
Focusing

Porawit Poboonma ball6847

🎯
Focusing
  • 7 Peaks Software Co., Ltd.
  • Bangkok, Thailand
View GitHub Profile
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/* load the MX_Router class */
require APPPATH."third_party/MX/Router.php";
/**
* Extends HMVC Modular Extension to modify route parsing
* to use Route class instead of default route handler
*
*
@ball6847
ball6847 / docker-dump.sh
Last active December 8, 2017 07:52 — forked from lalyos/save-all-images.sh
script to save all docker image, and load them back
#!/bin/bash
help() {
echo "\
Usage: $0 save - save all docker images to current directory
$0 load - find all images in current directory then import to docker"
exit 1
}
get-image-field() {
#!/bin/bash
DEPS_ROOT=/root
# build tools
yum install gcc make gcc-c++ openssl-devel sqlite-devel readline-devel bzip2-devel tk-devel zlib-devel wget
# libgit2 need python2.7 to build
cd $DEPS_ROOT
wget https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz
#!/bin/bash
TERM=xterm
PREFIX=/opt/gitlab
SOURCE_DIR=$PREFIX/src
LIB_DIR=$PREFIX/lib
GITLAB_HOME=$PREFIX/home/git
GITLAB_VERSION=8.3.2
GITLAB_INSTALL_DIR=$GITLAB_HOME/gitlab
GITLAB_SHELL_VERSION=2.6.9
@ball6847
ball6847 / mariadb-swarm.sh
Last active April 14, 2017 08:42
Create mariadb cluster using Docker Swarm
#!/bin/sh
# first, create overlay network to make all of your nodes can to talk to each others.
docker network create -d overlay mariadb-network
# then, create primary node, make sure you create the service with only 1 replica
docker service create \
--name mariadb-master \
--replicas 1 \
--mount target=/var/lib/mysql,source=/vol/mariadb-master,type=bind \
@ball6847
ball6847 / setup-docker-volume.sh
Created February 10, 2017 07:41
Shell script setup docker volume upon system start
#!/bin/bash
# save this script to setup-docker-volume.sh and chmod to allow executable (chmod +x setup-docker-volume.sh)
# Then add this entry to your crontab (generally at /var/spool/cron/root, /etc/cron.d, /etc/crontab)
# @reboot /path/to/setup-docker-volume.sh
set -e
wait_block() {
printf .
@ball6847
ball6847 / .bashrc
Last active August 31, 2017 05:08
ssh-tmux - shortcut to ssh then tmux
ssh-tmux() {
ssh -t "$@" tmux new-session -A -s main
}
# use it just like usual ssh command, it will immediately run tmux on remote server with session name "main"
@ball6847
ball6847 / skel-hub
Created September 15, 2017 15:20
Simple bash script to download and extract github repo to local directory, just like "git clone" but only the source code.
#!/bin/bash -e
if [ -z $1 ]; then
echo "skel-hub - download and extract github tarball
Usage: $0 user/repo [project]"
exit 1
fi
GITHUB_REPO=$1
@ball6847
ball6847 / gulpfile.js
Last active September 23, 2017 16:26
Using webpack with gulp
const gulp = require('gulp');
const gutil = require('gulp-util');
const webpack = require("webpack");
const WebpackDevServer = require("webpack-dev-server");
gulp.task("webpack", (callback) => {
const config = require('./webpack.config')('development');
const compiler = webpack(config);
@ball6847
ball6847 / medium-20170923-1.js
Last active September 23, 2017 18:13
Snippets for My Medium Article - 2017-09-23
soccerModule.controller('leagueListController', [
'$scope',
'selectors',
'store',
function($scope, selectors, store) {
$scope.$watch(() => selectors.count(store.getState()), count => {
// ...
});
}
]);