Skip to content

Instantly share code, notes, and snippets.

# From http://fahdshariff.blogspot.ca/2011/04/highlighting-command-output-with.html 加以修改
# 1. sudo apt install grc
# 2. 將本設定檔存到 ~/.grc/conf.tail (要自建.grc資料夾)
# 3. grc -c conf.tail tail -f webapp/website.log
# this configuration file is suitable for displaying log files
#errors
regexp=^.*(ERROR|Error|Exception).*$
colours=bold red
======
@amostsai
amostsai / install_docker_in_ubuntu_21-10.sh
Created November 12, 2021 05:29 — forked from pablodz/install_docker_in_ubuntu_21-10.sh
Install Docker in Ubuntu 21.10, Install Dockercompose on Ubuntu 21.10
# [🟨OPTIONAL] Uninstall old docker versions
sudo apt-get remove docker docker-engine docker.io containerd runc
# Refresh latest version
sudo apt-get update
# Install pre-req
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg \
@amostsai
amostsai / python
Last active July 3, 2019 18:05
python
# 從__init__.py載入變數的方法
from .__init__ import celery
@amostsai
amostsai / cloudSettings
Last active November 16, 2019 03:20
VScode_settings_sync
{"lastUpload":"2019-11-16T03:20:23.561Z","extensionVersion":"v3.4.3"}
## 匯出資料
mysqldump -u <account> -p <db_name> > <sql_file_name>
## 匯入資料
mysql -u <account> -p <db_name> < <sql_file_name>
@amostsai
amostsai / jinja2
Last active January 10, 2019 10:23
jinja2 特殊需求解決方法
# jinja2
## 資料轉換
{% set weeks = { '1' : '星期一', '2' : '星期二', '3': '星期三', '4': '星期四', '5': '星期五', '6': '星期六' } %}
<div class="col-md-3 col-sx-6">
<h2 class="text-primary">{{ weeks[course_post.week] }}</h2>
</div>

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@amostsai
amostsai / ipython_config.py
Created November 7, 2018 02:46
變更ipython設定,讓文字顏色能清楚顯示
# Configuration file for ipython.
#------------------------------------------------------------------------------
# InteractiveShellApp(Configurable) configuration
#------------------------------------------------------------------------------
## A Mixin for applications that start InteractiveShell instances.
#
# Provides configurables for loading extensions and executing files as part of
# configuring a Shell environment.
@amostsai
amostsai / vue
Last active July 3, 2019 18:05
改變Vue預設{{ }}
<script>
var app = new Vue({
el: '#app',
data: {
message1:
},
delimiters: ["${","}$"]
})
</script>
@amostsai
amostsai / Flask-Security and Flask-Admin
Last active July 3, 2019 18:06 — forked from skyuplam/gist:ffb1b5f12d7ad787f6e4
Flask-Security and Flask-Admin example by Steve Saporata
# Example of combining Flask-Security and Flask-Admin.
# by Steve Saporta
# April 15, 2014
#
# Uses Flask-Security to control access to the application, with "admin" and "end-user" roles.
# Uses Flask-Admin to provide an admin UI for the lists of users and roles.
# SQLAlchemy ORM, Flask-Mail and WTForms are used in supporting roles, as well.
from flask import Flask, render_template
from flask.ext.sqlalchemy import SQLAlchemy