Skip to content

Instantly share code, notes, and snippets.

View n37r06u3's full-sized avatar
🏠
Working from home

N37R09U3 n37r06u3

🏠
Working from home
  • China
View GitHub Profile
@n37r06u3
n37r06u3 / forms.py
Created August 24, 2016 12:39 — forked from oyakata/forms.py
djangoのRegexFieldの使用例
# -*- coding:utf-8 -*-
import re
from django import forms
USERID_REGEX = re.compile(r"^[\w-]+$")
class UserForm(forms.Form):
userid = forms.RegexField(max_length=64, regex=USERID_REGEX)
<!DOCTYPE html>
<html>
<head>
<title>Angular HTML5 Preview, Crop And Upload</title>
<style>
body {
padding: 50px;
font: 16px Helvetica;
}
@n37r06u3
n37r06u3 / odoo_install.sh
Created April 8, 2017 15:08 — forked from bistaray/odoo_install.sh
Install Odoo v10 Enterprise (with Bista repositories)
#!/bin/bash
################################################################################
# Script for installing Odoo V10 on Ubuntu 16.04, 15.04, 14.04
# Author: Yenthe Van Ginneken
# Adjusted: Ray Carnes
# Assumes you already have an Ubuntu user called "odoo" with a home folder
#-------------------------------------------------------------------------------
# Make a new file:
# sudo nano odoo-install.sh
# Place this content in it and then make the file executable:
@n37r06u3
n37r06u3 / odoo.conf
Created April 8, 2017 16:00 — forked from ryanc-me/odoo.conf
Sample Odoo/Nginx Config (with dbfilter_from_header support)
# Author: Ryan Cole
# Website: https://ryanc.me
# GitHub: https://github.com/MGinshe
# Usage:
# Place this file in /etc/nginx/sites-enabled/
# Make sure you edit the DOMAIN_HERE and SSL_CERTIFICATE, and DB_FILTER sections
#
# Note: This config file is designed to be used with the Odoo dbfilter_from_header module
# https://apps.openerp.com/apps/modules/9.0/dbfilter_from_header/
#!/usr/bin/python
# -*- coding: utf-8 -*-
# utf-8 中文编码
import glob
import os,sys
import json
reload(sys)
sys.setdefaultencoding('utf-8')
import time, sys,iptc # iptc 包通过 sudo pip install python-iptables 安装
from datetime import datetime
@n37r06u3
n37r06u3 / gist:78eb88ea444822ee04ddf0574065d54e
Created June 30, 2017 07:54 — forked from pulse-/gist:8655893
Django migrate sqlite3 db to postgres - The easy way.
I had this really small problem today. I wanted to migrate one of my small django apps to use postgres, just to make everything easy to manage. Sqlite3 is perfectly fine for the amount of load, however I am really much faster at administering postgres than I am on sqlite3. So I decided to migrate the stuff over.
I tried a few approaches, but what ultimately worked the best and the fastest fo rmy particular problem was to do the following.
Use original SQLITE3 connection in settings.py
1. python manage.py dumpdata > dump.json
(I read some things here about some options you can pass, at the end what just worked was the following)
2. Change DB connection string in settings.py to POSTGRES