Skip to content

Instantly share code, notes, and snippets.

View yaoquan's full-sized avatar

Yaoquan yaoquan

  • Qbasis
  • Singapore
View GitHub Profile
@yaoquan
yaoquan / server.md
Created January 6, 2024 16:58 — forked from jtadeulopes/server.md
Server setup with ubuntu, nginx and puma for rails app.

Update and upgrade the system

sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade && sudo apt-get autoremove
sudo reboot

Configure timezone

@yaoquan
yaoquan / multiple_realtime.py
Created February 11, 2022 09:31 — forked from adrobinoga/multiple_realtime.py
test script to read realtime events from multiple zkteco devices
import time
import datetime
from utils import *
import pyzk.pyzk as pyzk
from pyzk.zkmodules.defs import *
from pyzk.misc import *
"""
Script to connect to multiple ZKTeco devices and check the incoming events by pooling.
@yaoquan
yaoquan / AWS_Single_LetsEncrypt.yaml
Created November 25, 2020 19:30 — forked from tony-gutierrez/AWS_Single_LetsEncrypt.yaml
AWS Elastic Beanstalk .ebextensions config for single instance free SSL using letsencrypt certbot and nginx. http://bluefletch.com/blog/domain-agnostic-letsencrypt-ssl-config-for-elastic-beanstalk-single-instances/
# Dont forget to set the env variable "certdomain", and either fill in your email below or use an env variable for that too.
# Also note that this config is using the LetsEncrypt staging server, remove the flag when ready!
Resources:
sslSecurityGroupIngress:
Type: AWS::EC2::SecurityGroupIngress
Properties:
GroupId: {"Fn::GetAtt" : ["AWSEBSecurityGroup", "GroupId"]}
IpProtocol: tcp
ToPort: 443
@yaoquan
yaoquan / bootstrap.sh
Created April 22, 2016 17:06 — forked from wicz/bootstrap.sh
Configuration files and scripts for the blog post: Faster Rails 3 deployments to AWS Elastic Beanstalk http://horewi.cz/faster-rails-3-deployments-to-aws-elastic-beanstalk.html
#!/usr/bin/env bash
mkdir /var/app/ondeck/vendor /var/app/ondeck/public /var/app/support/bundle /var/app/support/assets /var/app/support/cache
ln -s /var/app/support/bundle /var/app/ondeck/vendor
ln -s /var/app/support/assets /var/app/ondeck/public
ln -s /var/app/support/cache /var/app/ondeck/vendor
sed -i 's/"rake/"bundle exec rake/' /opt/elasticbeanstalk/hooks/appdeploy/pre/11_asset_compilation.sh
@yaoquan
yaoquan / README.md
Created April 22, 2016 17:06 — forked from j-mcnally/README.md
Sample ElasticBeanstalk Config for Rails 3 on Puma and Using a bundle / gems cached on s3 for faster scaling.

Quick / Cached Bundles on ElasticBeanstalk

Bonus, support Rack 1.4.5 with puma for Rails 3 apps

Basically we bundle install on one box, upload the result to a dedicated s3 bucked and then other servers/nodes can download the gems and save a ton of time compiling them.

I can not stress enough how the bucked should be dedicated as it will often remove all the files in the bucket to clear the cache / do a new gem build each month incase changes are made to backing ami / software, you can adjust the prefix to clear the bundle "cache key" more frequently by appending more date modifiers such as day or hour if you run into issues.

Note: You can remove 14downgradepuma if your app runs on Rails 4

$('#menu article').css('overflow-y', 'hidden');
$('#menu article').css('overflow-y', '');
Joosy.namespace 'CompetencyUnits', ->
class @IndexPage extends ApplicationPage
@layout ApplicationLayout
@view 'index'
@fetch (complete) ->
CompetencyUnit.find 'all', (competency_units) =>
@data.competency_units = competency_units
@data.selectedCu = @data.competency_units.data[0]
2012-06-14T02:27:36+00:00 app[web.1]: Processing by Admin::CompetencyUnitsController#create as HTML
2012-06-14T02:27:36+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"04hBU6xsnbOoYP2D5xRa7p+yVxN2IXtK738CeA3ke98=", "competency_unit"=>{"run"=>"12", "qualification_ids"=>["", "11"], "name"=>"123", "code"=>"432", "discipline"=>"1231232", "entry_requirement"=>"<p>Course Structure</p>\r\n<p>The WSQ Diploma will be conducted in the form of lectures, discussions,</p>\r\n<p>demonstrations, case-studies, practical exercises, role plays and hands-on</p>\r\n<p>activities. Participants will complete 14 module as follows &ndash;</p>\r\n<p>1. Identify and Analyse Textiles and Process</p>\r\n<p>2. Analyze Garment Construction</p>\r\n<p>3. Interpret Pattern Draft and Sewing Sequence of Apparel</p>\r\n<p>4. Support Apparel Product Development</p>\r\n<p>5. Interpret and Draw Production Sketches</p>\r\n<p>6. Follow-Up Order from Design to Production for Textile and Fashion</p>\r\n<p>Industry</p>\r\n<p>7. C
<?php
$this->breadcrumbs=array(
'Groups'=>array('index'),
$model->name,
);
$this->menu=array(
array('label'=>'List Groups', 'url'=>array('index')),
array('label'=>'Create Groups', 'url'=>array('create')),
array('label'=>'Update Groups', 'url'=>array('update', 'id'=>$model->id)),
<?php
/**
* This is the model class for table "groups".
*
* The followings are the available columns in table 'groups':
* @property string $id
* @property integer $parentId
* @property string $path
* @property string $name