Skip to content

Instantly share code, notes, and snippets.

View sangdongvan's full-sized avatar
🎯
Focusing

Sang Dong sangdongvan

🎯
Focusing
  • AgilityIO
  • Vietnam
View GitHub Profile
@sangdongvan
sangdongvan / models.py
Created October 14, 2015 04:03
Advert Snippet in wagtaildemo
# Advert Snippet
class AdvertPlacement(models.Model):
page = ParentalKey('wagtailcore.Page', related_name='advert_placements')
advert = models.ForeignKey('demo.Advert', related_name='+')
class Advert(models.Model):
page = models.ForeignKey(
'wagtailcore.Page',
@sangdongvan
sangdongvan / runtests.py
Created October 14, 2015 07:41
Wagtail run testing
#!/usr/bin/env python
import sys
import os
import shutil
import warnings
from django.core.management import execute_from_command_line
from wagtail.tests.settings import STATIC_ROOT, MEDIA_ROOT
@sangdongvan
sangdongvan / .vimrc
Created October 14, 2015 08:29
vimrc formatting
" Formatting {
set showbreak=>\ \ \ " Long line wrap beginning of new line
set nowrap " Don't wrap long lines
set smartindent " Indent at the same level of the previous line
set shiftwidth=4 " Use indents of 4 spaces
set expandtab " Tabs are spaces, not tabs
set tabstop=4 " An indentation every four columns
set softtabstop=4 " Let backspace delete indent
set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J)
set splitright " Puts new vsplit windows to the right of the current
@sangdongvan
sangdongvan / load_initial_data.py
Created October 14, 2015 09:05
Example load fixture data with folder options
import os, shutil
from django.conf import settings
from django.core.management.base import NoArgsCommand
from django.core.management import call_command
class Command(NoArgsCommand):
def handle_noargs(self, **options):
fixtures_dir = os.path.join(settings.PROJECT_ROOT, 'demo', 'fixtures')
@sangdongvan
sangdongvan / appconfigs.txt
Last active October 14, 2015 09:22
AppConfigs & its models in a wagtail application
[wagtaildemo wagtaildemo]$ python manage.py ref_applications_1
<AuthConfig: auth>
<class 'django.contrib.auth.models.Permission'>
<class 'django.contrib.auth.models.Group'>
<class 'django.contrib.auth.models.User'>
<ContentTypesConfig: contenttypes>
<class 'django.contrib.contenttypes.models.ContentType'>
<SessionsConfig: sessions>
<class 'django.contrib.sessions.models.Session'>
<MessagesConfig: messages>
@sangdongvan
sangdongvan / delete_local_branch.sh
Created November 19, 2015 14:47
Delete all local branch start with "feature/" prefix
git branch | grep feature/ | while read feature
do
git branch -D $feature
done
@sangdongvan
sangdongvan / init.vim
Last active December 4, 2019 06:40
Neovim configuration
" Setup vim-plug -----------------------------------------------------------{{{
" Declare Plugin system Config
call plug#begin('~/.local/share/nvim/plugged')
" UI enhance
Plug 'Yggdroot/indentLine'
Plug 'airblade/vim-gitgutter'
Plug 'itchyny/lightline.vim'
gistup
@sangdongvan
sangdongvan / application.properties
Created January 16, 2018 07:39
Config Postgres Datasource for SpringBoot Application
# ===============================
# = DATA SOURCE
# ===============================
# Set here configurations for the database connection
spring.datasource.url=jdbc:postgresql://localhost:5432/springbootdb
spring.datasource.username=postgres
spring.datasource.password=postgres@123
spring.datasource.driver-class-name=org.postgresql.Driver
# Keep the connection alive if idle for a long time (needed in production)
spring.datasource.testWhileIdle=true

install kubernetes 1.6 on centos 7.3

Install kubelet, kubeadm, docker, kubectl and kubernetes-cni

1. Install Docker

yum remove -y docker docker-common docker-selinux docker-engine
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce-17.12.0.ce