Skip to content

Instantly share code, notes, and snippets.

View NamPNQ's full-sized avatar
🤒
Out sick

Nam PHAM NamPNQ

🤒
Out sick
  • Ho Chi Minh
View GitHub Profile
@NamPNQ
NamPNQ / fix_docker.sh
Created April 6, 2016 06:03
Fix docker: Error initializing network controller
sudo rm -rf /var/lib/docker/network
@NamPNQ
NamPNQ / get_polygons.py
Last active July 3, 2020 02:02
polygons cac quan o viet nam
# -*- coding: utf8 -*-
import json
import requests
import codecs
import locale
import sys
# Wrap sys.stdout into a StreamWriter to allow writing unicode.
sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout)
@NamPNQ
NamPNQ / fabfile.py
Created March 28, 2016 09:20
fabric with virtualenv
from fabric.api import lcd, local, path
project_dir = '/www/my_project/sms/'
env_bin_dir = project_dir + '../env/bin/'
def deploy():
with lcd(project_dir):
local('git pull origin')
local('git checkout -f')
with path(env_bin_dir, behavior='prepend'):
@NamPNQ
NamPNQ / .gitconfig
Created February 17, 2016 06:33 — forked from ViktorStiskala/.gitconfig
Pycharm as a default git difftool and git mergetool. Add the following to ~/.gitconfig
[diff]
tool = pycharm
[difftool "pycharm"]
cmd = /usr/local/bin/charm diff "$LOCAL" "$REMOTE" && echo "Press enter to continue..." && read
[merge]
tool = pycharm
keepBackup = false
[mergetool "pycharm"]
cmd = /usr/local/bin/charm merge "$LOCAL" "$REMOTE" "$BASE" "$MERGED"
// This is special version for fix conflict with videogular-youtube-plugin
(function (){
'use strict';
/**
* @ngdoc overview
* @name angularVideoBg
* @description This module contains a directive that allows you easily make a YouTube video play as the background of
* any container on your site.
*/
@NamPNQ
NamPNQ / koel.md
Last active January 19, 2016 07:56
Koel docker
  1. Install docker and docker-compose
  2. Download file https://github.com/NamPNQ/koel/blob/feature-docker/docker-compose.yml and https://github.com/NamPNQ/koel/blob/feature-docker/.env.example
  3. Rename .env.example to .env
  4. Edit .env
    APP_KEY: 16efa6c23c2e8c705826b0e66778fbe7
    DB_HOST=db
    DB_DATABASE=koel
    DB_USERNAME=root
    

DB_PASSWORD=secret

@NamPNQ
NamPNQ / nginx.conf
Last active July 5, 2019 11:39
Symfony nginx dev config
# Store in /etc/nginx/conf.d/symfony_project.conf
server {
server_name symfony_project.localhost;
root /home/Workspace/symfony_project/web;
location / {
# try to serve file directly, fallback to app.php
try_files $uri /app_dev.php$is_args$args;
}
# DEV
@NamPNQ
NamPNQ / dump_for_mysql.py
Created January 7, 2016 07:12
Migrate SQLite3 to MySQL
#!/usr/bin/env python
import re
import fileinput
def this_line_is_useless(line):
useless_es = [
'BEGIN TRANSACTION',
'COMMIT',
'sqlite_sequence',
@NamPNQ
NamPNQ / flake8
Created January 4, 2016 08:17
config flake8 global
# store in ~/.config/flake8
[flake8]
ignore = F999,E501,E128,E124,E126,F841,E123,F401,F403
max-line-length = 120
exclude = env, .git
from fabric.api import run
def check_status():
run('df -h')
run('service --status-all | grep running')
# How to use
# pip install fabric
# fabric check_status -H root@xxx.xxx.xxx.xxx