Skip to content

Instantly share code, notes, and snippets.

View xgenvn's full-sized avatar

TuNA xgenvn

View GitHub Profile
@xgenvn
xgenvn / hackintosh - guide.md
Last active January 7, 2019 17:45
Asus Z370 ITX + i5 8400 + Gigabyte 1060 3G
@xgenvn
xgenvn / Free SSL licencse.md
Last active June 20, 2018 04:53
PhotonOS and Rancher server

Stop any containers listening on port 80 or 443

export DOMAIN=[whatever domain you are creating a certificate for]

docker run -it --rm -p 443:443 -p 80:80 \
  --name certbot \
  -v "$(pwd)/letsencrypt/etc:/etc/letsencrypt" \
  -v "$(pwd)/letsencrypt/var/lib/:/var/lib/letsencrypt" \
  quay.io/letsencrypt/letsencrypt:latest certonly
@xgenvn
xgenvn / Builder vs Factory.md
Last active May 31, 2018 01:34
Design Patterns notes

Builder focuses on constructing a complex object step by step. Abstract Factory emphasizes a family of product objects (either simple or complex). Builder returns the product as a final step, but as far as the Abstract Factory is concerned, the product gets returned immediately.

Builder often builds a Composite. Often, designs start out using Factory Method (less complicated, more customizable, subclasses proliferate) and evolve toward Abstract Factory, Prototype, or Builder (more flexible, more complex) as the designer discovers where more flexibility is needed.

Sometimes creational patterns are complementary: Builder can use one of the other patterns to implement which components get built. Abstract Factory, Builder, and Prototype can use Singleton in their implementations.

Short:

@xgenvn
xgenvn / ngnix.conf
Created May 18, 2018 01:18 — forked from WhisperingChaos/ngnix.conf
NGINX SSL/TLS Reverse Proxy to Upstream SSL servers.
events {
# nginx requires this section even when applying all default values
}
http {
# Upstream keyword is followed by a url (domain name/IP). This reference encapsulates
# the list of backend servers defined for a virtual proxy. When autnenticating
# a certificate from a backend server, the upstream url is supplied to the
# certificate authentication process instead of the backend server name. See
# the comments associated with proxy_pass below for a detailed discussion.
@xgenvn
xgenvn / makemigrations.py
Created May 12, 2018 04:47 — forked from r3m0t/makemigrations.py
Migration conflict file
# coding: utf-8
"""Cause git to detect a merge conflict when two branches have migrations."""
# myapp/management/commands/makemigrations.py
# you'll need myapp/management/commands/__init__.py and myapp/management/__init__.py in PY2, see Django docs
from __future__ import absolute_import, unicode_literals
import io
import os
import six
@xgenvn
xgenvn / guide.md
Created May 8, 2018 01:58
Alllow remote connection AZURE SQLServer
EXECUTE sp_set_database_firewall_rule N'Another_Rule', '11.11.11.11', '11.11.11.11';
@xgenvn
xgenvn / whaaaacked.md
Created May 6, 2018 15:41
God please help me with MYSQL upgrade failed while updating mysql server under Ubuntu
apt install apparmor-utils
aa-complain /usr/sbin/mysqld
cd /tmp/
apt-get download mysql-server-5.7
dpkg --unpack mysql-server-5.7<serious-tab>.deb
rm /var/lib/dpkg/info/mysql-server-5.7.postinst
dpkg --configure mysql-server-5.7
service mysql restart
@xgenvn
xgenvn / example.md
Created May 6, 2018 15:38
Example build arg docker
version: "2"
services:

  lumen:
    build:
      context: .
      dockerfile: ./Dockerfile
      args:
 - PORT=${PORT}
@xgenvn
xgenvn / patch.md
Created May 4, 2018 01:33
Patch VirtualBox for MacOS

Code for Virtualbox 5.x.x:

cd "C:\Program Files\Oracle\VirtualBox\"
VBoxManage.exe modifyvm "Virtual Machine Name" --cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbff
VBoxManage setextradata "Virtual Machine Name" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac11,3"
VBoxManage setextradata "Virtual Machine Name" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"
VBoxManage setextradata "Virtual Machine Name" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple"
VBoxManage setextradata "Virtual Machine Name" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VBoxManage setextradata "Virtual Machine Name" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1
@xgenvn
xgenvn / CouchDB_Python.md
Created April 24, 2018 15:36 — forked from marians/CouchDB_Python.md
The missing Python couchdb tutorial

This is an unofficial manual for the couchdb Python module I wish I had had.

Installation

pip install couchdb

Importing the module