Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: ci
on:
push:
branches:
- master
- main
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install mkdocs-material mkdocs-glightbox
- run: mkdocs gh-deploy --force
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
# code_snippets
# Code Snippets

# Welcome to Code Snippets

## Commands

* `mkdocs new [dir-name]` - Create a new project.
* `mkdocs serve` - Start the live-reloading docs server.
* `mkdocs build` - Build the documentation site.
* `mkdocs -h` - Print help message and exit.
1 change: 1 addition & 0 deletions docs/assets/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Welcome to Code Snippets
1 change: 1 addition & 0 deletions docs/python/geopandas.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# GeoPandas
1 change: 1 addition & 0 deletions docs/python/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# python
26 changes: 26 additions & 0 deletions docs/sql/ganos/ST_AsImage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
comments: true
---

# [ST_AsImage](https://help.aliyun.com/zh/polardb/polardb-for-postgresql/st-asimage?spm=a2c4g.11186623.help-menu-2249963.d_8_5_3_2.435d1dc7c8te2K)

将栅格对象转化为影像格式二进制流。

```sql
SELECT
encode(
ST_AsImage (
rast,
'(140.025,60.025),(69.975,-0.025)' :: box
0,
'0',
'jpeg',
'{"strength": "ratio", "quality": 70}'
),
'hex'
)
FROM
surf_hor_metadata
WHERE
ele = 'PRE'
```
3 changes: 3 additions & 0 deletions docs/sql/ganos/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# [时空引擎(GanosBase)](https://help.aliyun.com/zh/polardb/polardb-for-oracle/ganosbase-spatio-temporal-database/?spm=a2c4g.11186623.help-menu-2249963.d_9.6f7d7f1fFlqiaA)


1 change: 1 addition & 0 deletions docs/sql/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# SQL
139 changes: 139 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
site_name: Code Snippets

# Repository
repo_name: huanglii/code-snippets
repo_url: https://github.com/huanglii/code-snippets
edit_uri: edit/main/docs/

# Copyright
copyright: Copyright © 2025 huangli

theme:
name: material
language: zh
logo: assets/logo.png
favicon: assets/favicon.svg
custom_dir: overrides
icon:
repo: fontawesome/brands/git-alt
palette:
# Palette toggle for light mode
- scheme: default
primary: teal
accent: teal
toggle:
icon: material/brightness-7
name: 深色

# Palette toggle for dark mode
- scheme: slate
primary: teal
accent: teal
toggle:
icon: material/brightness-4
name: 浅色
font:
text: Noto Sans SC
code: Fira Code
features:
- content.action.edit
# - content.action.view
- content.code.copy
- content.code.annotate
# - content.code.select
- content.tooltips

- navigation.instant
- navigation.tracking
# - navigation.sections
# - navigation.tabs
# - navigation.tabs.sticky
- navigation.path
# - navigation.prune
# - navigation.expand
- navigation.indexes
- navigation.top
- navigation.footer

- search.highlight
- search.share
- search.suggest

- toc.follow
# - toc.integrate

plugins:
- glightbox
- search
- tags

extra_css:
- stylesheets/extra.css

extra_javascript:
- javascripts/mathjax.js
- https://polyfill.io/v3/polyfill.min.js?features=es6
- https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js

extra:
social:
- icon: fontawesome/brands/github
link: https://github.com/huanglii
# generator: false

# Extensions
markdown_extensions:
- abbr
- admonition
- attr_list
- def_list
- footnotes
- md_in_html
- toc:
permalink: true
- tables
- pymdownx.arithmatex:
generic: true
- pymdownx.betterem
- pymdownx.caret
- pymdownx.mark
- pymdownx.tilde
- pymdownx.critic:
mode: view
- pymdownx.details
- pymdownx.emoji:
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg
- pymdownx.highlight:
linenums: true
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
- pymdownx.inlinehilite
- pymdownx.keys
- pymdownx.magiclink:
repo_url_shorthand: true
user: squidfunk
repo: mkdocs-material
- pymdownx.smartsymbols
- pymdownx.superfences:
custom_fences:
- name: mermaid
class: mermaid
format: !!python/name:pymdownx.superfences.fence_code_format
- pymdownx.tabbed:
alternate_style: true
- pymdownx.tasklist:
custom_checkbox: true

# Page tree
# nav:
# - 第 1 章 Python:
# - python/index.md
# - 1.1 GeoPandas: python/geopandas.md
# - 第 2 章 SQL:
# - sql/index.md
# - 2.1 Ganos:
# - sql/ganos/index.md
# - sql/ganos/ST_AsImage.md

48 changes: 48 additions & 0 deletions overrides/partials/comments.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{% if page.meta.comments %}
<h2 id="__comments">{{ lang.t("meta.comments") }}</h2>
<!-- Insert generated snippet here -->
<script src="https://giscus.app/client.js"
data-repo="huanglii/code-snippets"
data-repo-id="R_kgDON_sQAQ"
data-category="Announcements"
data-category-id="DIC_kwDON_sQAc4CnZfw"
data-mapping="title"
data-strict="0"
data-reactions-enabled="1"
data-emit-metadata="0"
data-input-position="top"
data-theme="preferred_color_scheme"
data-lang="zh-CN"
crossorigin="anonymous"
async>
</script>
<!-- Synchronize Giscus theme with palette -->
<script>
var giscus = document.querySelector("script[src*=giscus]")

/* Set palette on initial load */
var palette = __md_get("__palette")
if (palette && typeof palette.color === "object") {
var theme = palette.color.scheme === "slate" ? "dark" : "light"
giscus.setAttribute("data-theme", theme)
}

/* Register event handlers after documented loaded */
document.addEventListener("DOMContentLoaded", function() {
var ref = document.querySelector("[data-md-component=palette]")
ref.addEventListener("change", function() {
var palette = __md_get("__palette")
if (palette && typeof palette.color === "object") {
var theme = palette.color.scheme === "slate" ? "dark" : "light"

/* Instruct Giscus to change theme */
var frame = document.querySelector(".giscus-frame")
frame.contentWindow.postMessage(
{ giscus: { setConfig: { theme } } },
"https://giscus.app"
)
}
})
})
</script>
{% endif %}