Skip to content

Instantly share code, notes, and snippets.

View nanlabsweb's full-sized avatar

nanlabsweb

View GitHub Profile
$brand-color-unit: 6%;
$brand-primary: #5d73f5 !default;
$brand-primary-light: lighten($brand-primary, $brand-color-unit) !default;
$brand-primary-lighter: lighten($brand-primary, $brand-color-unit*2) !default;
$brand-info: #65efe2 !default;
$brand-info-light: lighten($brand-info, $brand-color-unit) !default;
$brand-info-lighter: lighten($brand-info, $brand-color-unit*2) !default;
@nanlabsweb
nanlabsweb / Dockerfile
Last active August 18, 2016 10:45
POST - Dockerfile sample for post.
FROM ubuntu
MAINTAINER NaN Labs
# install default aptitude apache2
# try to use the less amount of RUN executions
# to reduce the image binary file
RUN apt-get update && apt-get install -y apache2
# environment variable deployKey will be available
@nanlabsweb
nanlabsweb / init.sh
Last active August 18, 2016 10:45
POST - Docker init script.
#!/bin/bash
# we can add any command to be executed whe the container is run
tail -f /dev/null
@nanlabsweb
nanlabsweb / post-docker-bonus.sh
Created August 18, 2016 10:46
POST - Docker useful commands.
# remove all containers
sudo docker rm $(sudo docker ps -a -q)
# view last container
sudo docker ps -l
# remove all non-running containers
sudo docker ps -a | grep Exited | awk '{ print $NF }' | xargs sudo docker rm
# remove image containing TERM
@nanlabsweb
nanlabsweb / post-profile-module.js
Created August 18, 2016 11:15
POST - Angular profile module.
angular.module('profile', ['ngRoute']).config(function($stateProvider) {
return $stateProvider.state('my', {
url: '/my',
templateUrl: 'my-view.html',
abstract: true
});
});
@nanlabsweb
nanlabsweb / post-my-view.html
Created August 18, 2016 11:16
POST - Angular view example.
<ng-include src="'header-view.html'"></ng-include>
<ng-include src="'top-profile-navigation.html'"></ng-include>
<div class="row">
<div ui-view="aside-navigation"></div>
<div ui-view="content"></div>
</div>
<ng-include src="'footer-view.html'"></ng-include>
@nanlabsweb
nanlabsweb / post-my-messages-state.js
Created August 18, 2016 11:18
POST - Angular state example.
angular.module('profile').config(function($stateProvider) {
return $stateProvider.state('my.messages', {
url: '/messages',
views: {
'aside-navigation': {
templateUrl: 'aside-messages.html',
controller: 'AsideMessagesController'
},
'content': {
template: '<div ui-view="content"></div>'
@nanlabsweb
nanlabsweb / post-my-messages-child-states.js
Created August 18, 2016 11:19
POST - Angular child states example.
angular.module('profile').config(function($stateProvider) {
return $stateProvider.state('my.messages.new', {
url: '/new',
views: {
'content': {
templateUrl: 'new-message.html',
controller: 'NewMessageController'
}
}
}).state('my.messages.inbox', {
@nanlabsweb
nanlabsweb / post-logrotate
Last active August 18, 2016 11:37
POST - Logrotate example.
/var/log/example/*.log {
su example adm
daily
missingok
rotate 52
compress
delaycompress
notifempty
create 644 example adm
postrotate
@nanlabsweb
nanlabsweb / post-create-deb-package.sh
Created August 18, 2016 11:38
POST - Create deb package example.
#!/bin/bash
APP_NAME=example-app
PACKAGE_NAME=${APP_NAME}_1.0-0 #Standard Debian notation <project>_<major version>.<minor version>-<package revision>
mkdir -p $PACKAGE_NAME/DEBIAN #Copy control, postinst, preinst scripts here
mkdir -p $PACKAGE_NAME/etc/$APP_NAME #Copy conf.json file here
mkdir -p $PACKAGE_NAME/etc/init/ #Copy ${APP_NAME}.conf upstart script here
mkdir -p $PACKAGE_NAME/etc/logrotate.d/ #Copy $APP_NAME logrotate script here
mkdir -p $PACKAGE_NAME/var/lib/$APP_NAME #Copy application src here
mkdir -p $PACKAGE_NAME/var/log/$APP_NAME #keep empty