Skip to content

Instantly share code, notes, and snippets.

View tuantranf's full-sized avatar
🎯
Focusing

Tuan (Mike) Tran tuantranf

🎯
Focusing
View GitHub Profile
@tuantranf
tuantranf / README.md
Created April 10, 2016 11:25 — forked from Hypercubed/README.md
DocPad: rsync Deploy Script

DocPad: rsync Deploy Script

  • Place deploy.sh in {docpad folder}/bin/
  • Create (or edit) a .env file in your docpad folder with the following values:
#!/bin/bash
DEPLOY_SOURCE_DIR="out/"
DEPLOY_DEST_DIR="~/public_html/"
DEPLOY_SERVER=deploy-server-name

AWS yesterday billing slack bot

var aws = require('aws-sdk');
var url = require('url');
var https = require('https');
var hookUrl, slackChannel;
var cloudwatch = new aws.CloudWatch({region: 'us-east-1', endpoint: 'http://monitoring.us-east-1.amazonaws.com'});

hookUrl = 'SLACK_IN_COMING_WEBHOOK_URL';
@tuantranf
tuantranf / .ebextensions\deploy.config
Created July 20, 2017 22:01 — forked from pdib/.ebextensions\deploy.config
Installing node and npm on a Django AWS ElasticBeanstalk
# This specifies the deployment process on AWS ElasticBeanstalk for a Django app using npm and Postgres.
#
# The target environment should have access to a Postgres Database through environment variables.
# The environment can be setup using `eb create --database.engine=postgres`
# The necessary environment variables to access the database will be automatically defined on the
# instances of that environment.
#
# In addition, the target environment should define environment variables (django secret key ...).
# They can be manually defined using the AWS ElasticBeanstalk interface on the web.
# They can also be specified when creating the environment from command line, for example:
@tuantranf
tuantranf / checkIosProvisiongProfile.md
Created January 1, 2018 14:20 — forked from akofman/checkIosProvisiongProfile.md
Check devices in a provisioning profile

After exporting an ipa for Ad Hoc Deployment, it could be useful to check if all authorized devices are well configured in a provisioning profile. To read a provisioning profile you have to unarchive your ipa :

$ unzip your.ipa

find the embedded.mobileprovision file :

$ ls yourUnzippedIpa/Payload/appName.app/embedded.mobileprovision
@tuantranf
tuantranf / laraveltimestamps.py
Created February 22, 2018 23:34 — forked from pepijnolivier/laraveltimestamps.py
Create laravel timestamps on each table in mysqlworkbench.
# -*- coding: utf-8 -*-
# MySQL Workbench Python script
#
# <description>
# Written in MySQL Workbench 6.3.6
# Fetch all tables,
# For each table, add created_at, updated_at, deleted_at timestamps,
# Except for many-to-many tables
# Configurable options:
# addDeletedAt: True / False. Add the deleted_at timestamp column
@tuantranf
tuantranf / circle.yml
Created March 23, 2018 22:06
Nice setup for testing using Circle CI
machine:
php:
version: 7.1.3
dependencies:
pre:
- mkdir -p ~/.composer/cache
- mkdir -p ~/.php-cs-fixer
- echo "memory_limit = 256M" > /opt/circleci/php/$(phpenv global)/etc/conf.d/memory.ini
override:
@tuantranf
tuantranf / eb_deploy_and_notify.sh
Created March 28, 2018 16:33 — forked from ijin/eb_deploy_and_notify.sh
Deploy to Elastic Beanstalk and notify via Slack
#!/bin/bash
set -x
export SHA1=`echo ${CIRCLE_SHA1} | cut -c1-7`
export ENV=`echo $1 | rev | cut -d \- -f1 | rev`
function dd_mute() {
if [[ ${DD_MUTE_ID+x} ]]; then
echo "muting DD monitor id: ${DD_MUTE_ID}"
curl -X POST "https://app.datadoghq.com/api/v1/monitor/${DD_MUTE_ID}/mute?api_key=${DD_API_KEY}&application_key=${DD_APP_KEY}"
@tuantranf
tuantranf / mkdir_p.js
Created June 13, 2018 03:28 — forked from bpedro/mkdir_p.js
nodejs implementation of recursive directory creation (https://brunopedro.com/2010/12/15/recursive-directory-nodejs/)
var fs = require('fs');
/**
* Offers functionality similar to mkdir -p
*
* Asynchronous operation. No arguments other than a possible exception
* are given to the completion callback.
*/
function mkdir_p(path, mode, callback, position) {
mode = mode || 0777;
@tuantranf
tuantranf / Dockerfile
Created July 30, 2018 17:46 — forked from kyleferguson/Dockerfile
Example Laravel deployment for Kubernetes
FROM php:7.1-apache
ADD . /var/www
ADD ./site.conf /etc/apache2/sites-enabled/000-default.conf
RUN apt-get update && apt-get install -y libmcrypt-dev mysql-client && \
docker-php-ext-install mcrypt pdo_mysql opcache && \
pecl install redis-3.1.2 && docker-php-ext-enable redis && \
a2enmod rewrite
@tuantranf
tuantranf / kubeadm-install-offline.md
Last active August 15, 2019 09:13 — forked from onuryilmaz/kubeadm-install-offline.md
Offline Kubeadm install