Skip to content

Instantly share code, notes, and snippets.

View virasak's full-sized avatar

Virasak Dungsrikaew virasak

View GitHub Profile
<#
Create Unix VM's.
PREREQUISITES:
- A VM that has been installed with an OS that supports cloud-init
- cloud-init is installed on the vm
How it works:
- Asks for a bunch of parameters
- Creates a disk from parent vhdx for speed
@virasak
virasak / install.sh
Created November 23, 2023 15:26
Install Docker in Ubuntu-WSL2
echo hello world
/*
# Start an Express Server
- Requests to install `express` and `detect-port`
- Starts an express server
- Opens the local url once server is running
*/
// Name: Express Server
// Description: Start an Express server
@virasak
virasak / scoop-export.json
Created July 8, 2023 03:33
[Scoop] Export data from `scoop export` #scoop
{
"apps": [
{
"Info": "",
"Source": "main",
"Name": "7zip",
"Version": "23.01",
"Updated": "2023-07-06T20:45:52.7720128+07:00"
},
{
@virasak
virasak / auth-basic.conf
Created January 10, 2017 00:13 — forked from Thermionix/auth-basic.conf
nginx reverse proxy for sickbeard, couchpotato etc.
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/htpasswd;
@virasak
virasak / monad-inside-out.md
Last active September 17, 2016 19:20
Monad: Inside out

Mathmatic-like function

(a: int) : int => 1 + a

Q1: What if a can be NULL

1 + NULL ???

Q2: What if 1 + a can be NULL

/*
* WebDriver Dispatcher router
* Register to express:
* app.use('/session', this_module);
*/
var process = require('process');
var express = require('express');
var request = require('request');
var router = module.exports = express.Router();
@virasak
virasak / context.json
Last active August 29, 2015 01:06
Handlebars Subexpressions
{ "foo" : "Foo", "bar": "Bar"}

FiniteAuditTrail Trait

Support for keeping an audit trail for any state machine, borrowed from the Ruby StateMachine audit trail gem. Having an audit trail gives you a complete history of the state changes in your model. This history allows you to investigate incidents or perform analytics, like: “How long does it take on average to go from state a to state b?”, or “What percentage of cases goes from state a to b via state c?”

Requirements

  1. PHP >= 5.4
  2. Laravel 4 framework
@virasak
virasak / .tmux.conf
Last active August 7, 2018 23:52
My Tmux conf
set -g default-terminal "screen-256color"
set -g utf8 on
set status-utf8 on
set -g status-bg black
set -g status-fg white
set -g status-position top
set -w -g window-status-current-bg white
set -w -g window-status-current-fg black