Skip to content

Instantly share code, notes, and snippets.

View lorne-luo's full-sized avatar

Lorne Luo lorne-luo

  • Melbourne, Australia
View GitHub Profile
--- a/certification/forms.py
+++ b/certification/forms.py
@@ -309,3 +309,47 @@ class BaseCertRecipeIngredientFormSet(BaseFormSet):
+class CertRecipeAttachmentForm(forms.ModelForm):
+ # id = forms.CharField(label=_("id"), max_length=254, required=False, widget=forms.HiddenInput())
+ type = forms.ChoiceField(label=_("Attachment type"), choices=[('', '----')] + RECIPE_ATTACHMENT_TYPE_CHOICES,
+ required=True,
+ error_messages={'required': "Please select type."})
+ file = ExtFileField(label=_("File"), required=False,
+ ext_whitelist=['.pdf', '.doc', '.docx', '.jpg', '.png', '.gif', '.eps'],
# properly install redis follow official doc on centos
# https://redis.io/topics/quickstart#installing-redis-more-properly
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make
sudo cp src/redis-server /usr/local/bin/
sudo cp src/redis-cli /usr/local/bin/
@lorne-luo
lorne-luo / server_init.sh
Last active November 9, 2017 21:46
Setup Centos Server
sudo timedatectl set-timezone Australia/Sydney
sudo yum -y update
sudo yum -y install gcc gcc-c++ kernel-devel libxml++-devel libxml2-devel python-devel libxslt-devel libffi-devel openssl-devel mysql-devel
sudo yun -y install ImageMagick-devel libcurl-devel wget zip git bash-completion bash-completion-extras curl enchant
ssh-keygen -t rsa -b 4096 -C "[email protected]"
cat ~/.ssh/id_rsa.pub
sudo vi /etc/sysconfig/network
sudo echo 'HOSTNAME=luotao.net' >> /etc/sysconfig/network
@lorne-luo
lorne-luo / karabiner-settings.sh
Last active April 12, 2016 07:03
Karabiner Settings
#!/bin/sh
cli=/Applications/Karabiner.app/Contents/Library/bin/karabiner
$cli set remap.fn_fkeys_to_consumer_f10 1
/bin/echo -n .
$cli set private.holdingEscape_to_Control-L 1
/bin/echo -n .
$cli set switch_input_language 1
/bin/echo -n .