Skip to content

Instantly share code, notes, and snippets.

@TheMatt2
TheMatt2 / pathtype.py
Last active October 6, 2023 04:25
Python PathType helper type for input validation in argparse for paths.
"""
PathType
A helper type for input validation in argparse for paths.
This provides a convienent way to check the paths type, existance, and
potentially use "-" to reference stdin or stdout.
This class is provided as an alternative to argparse.FileType(), which
does not open the path, only validates it and supports directories.
@MrTrustor
MrTrustor / clean-docker-for-mac.sh
Last active November 21, 2023 11:38
This script cleans the Docker.qcow2 file that takes a lot of disk space with Docker For Mac. You can specify some Docker images that you would like to keep.
#!/bin/bash
# Copyright 2017 Théo Chamley
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
# to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or
@sanshu
sanshu / d3-heatmap-dendro.js
Last active April 4, 2024 20:29
d3 heatmap with dendrograms
/*
* Mayya Sedova <msedova.dev@gmail.com>
* See it in action https://sanshu.github.io/d3-heatmap-dendrogram/
*/
(function () {
d3.heatmapDendro = function (data, parent) {
if (!data || !data.matrix)
@qrtt1
qrtt1 / GoogleApiUsage.md
Last active January 11, 2022 09:45
Note for learning google api for python (google api 的學習筆記)

由於 Google API 久久才會用一次,但它的文件對我來說實在是不好閱讀,應該花點時間把它筆記起來才是。

學習曲線分析

閱讀 Google API 使用文件,覺得難以閱讀的主要原因是它分成許多部分,每一部分不一定跟你要做的功能相關,而是在滿足你能使用 API 的基本條件。要攻略使用文件就必需清楚知道哪些是屬於「共通科目」、「必修科目」屬於任何產品的 API 使用前都必需滿足的。

內容分為下列主題:

  1. API 的設計哲學:Service Discovery (描述 API 的 API)
  2. API 開通與證認:API Console & OAuth 2