Skip to content

Instantly share code, notes, and snippets.

View parnurzeal's full-sized avatar

Theeraphol Wattanavekin parnurzeal

View GitHub Profile
@parnurzeal
parnurzeal / runApp-1.dart
Created March 23, 2020 06:18
Flutter Beginner
import 'package:flutter/material.dart';
void main() {
runApp(
Center(
child: Text(
'Hello, world!',
textDirection: TextDirection.ltr,
),
),
@parnurzeal
parnurzeal / .zshrc
Created June 17, 2018 03:08
My .zshrc file
##### Set PATH #####
# Homebrew
export PATH="$PATH:$HOME/homebrew/bin"
# My Bin
export PATH="$PATH:$HOME/bin"
####################
##### Add preminalry scripts & dependencies #####
# Add Homeshick
if [[ ! -d "$HOME/.homesick/repos/homeshick" ]]; then
git clone git://github.com/andsens/homeshick.git $HOME/.homesick/repos/homeshick
@parnurzeal
parnurzeal / stop_chatting.js
Last active August 6, 2017 08:36
Stop api.ai from chatting
const admin = require('firebase-admin');
const auth = require('basic-auth')
const functions = require('firebase-functions');
admin.initializeApp(functions.config().firebase);
exports.webhook = functions.https.onRequest((req, res) => {
// Check if api.ai provides a correct user/pass
const credentials = auth(req);
if (!credentials || credentials.name != 'username' || credentials.pass != 'password') {
package main
import (
"bufio"
"fmt"
"io"
"net"
"net/http"
)
@parnurzeal
parnurzeal / template.cpp
Created November 16, 2014 10:41
C++ Coding Problem Template
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cctype>
#include<cstring>
#include<vector>
#include<list>
#include<queue>
@parnurzeal
parnurzeal / sails
Last active August 29, 2015 14:08
Dockerfile
#This is a comment
FROM centos:centos6
MAINTAINER Theeraphol Wattanavekin <[email protected]>
# Basic packages for work & troubleshooting
RUN yum update -y && yum install -y \
git \
vim \
zsh \
tar
RUN rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
@parnurzeal
parnurzeal / gist:74d0a3082bb56a607639
Created September 11, 2014 09:09
go_routine_writing_file.go
func doKickoff2(opts Option) {
scriptName := opts.Kickoff2.ScriptName
configFile := opts.Kickoff2.ConfigFile
contentByte, err := ioutil.ReadFile(opts.Kickoff2.ConfigFile)
if err != nil {
log.Error("%v", err)
return
}
var config TomlConfig
_, err = toml.Decode(string(contentByte), &config)
git checkout master
COOKBOOK=`git log -1 --pretty=%s | awk '{print $1}'`
VERSION=`git log -1 --pretty=%s | awk '{print $2}'`
# In case, Jenkins commit merge before build
if [ "$COOKBOOK" == "Merge" ] ; then
COOKBOOK=`git log -2 --pretty=%s | tail -1 | awk '{print $1}'`
VERSION=`git log -2 --pretty=%s | tail -1 | awk '{print $2}'`
fi
Vagrant::Config.run do |config|
# debug default is :headless
config.vm.boot_mode = "gui"
# the .box file
config.vm.box = "afa-chef-server"
config.vm.box_url = "/V3/base_debian/with-apt.box"
# ssh config
config.ssh.private_key_path = "afa_private_key"
source 'https://rubygems.org'
group :test do
gem 'chefspec', '~> 3.4.0'
gem 'foodcritic', '~> 3.0.3'
gem 'strainer', '~> 3.0'
gem 'test-kitchen', '~> 1.2.1'
gem 'knife-spork', '~> 1.3.2'
gem 'hipchat', '~> 1.1.0'
gem 'guard', '~> 1.8.3'