Skip to content

Instantly share code, notes, and snippets.

@sandys
sandys / Fastapi-sqlalchemy-pydantic-dataclasses-reloadable-logging.md
Last active June 30, 2024 09:23
fastapi with python 3.10 dataclasses - used to create both sqlalchemy and pydantic models simultaneously. And setting up sqlalchemy the right way (without deadlocks or other problems). Additionally, this also takes care of unified logging when running under gunicorn..as well as being able to run in restartable mode.
@qrtt1
qrtt1 / 000_2020-12th-ironman.md
Last active September 3, 2023 07:16
ITHome 第 12 屆鐵人賽 (updated UTC 2020-10-19 00:40:39.204524)
@bryanbraun
bryanbraun / git-branching-diagram.md
Last active July 29, 2024 04:30
Example Git Branching Diagram

Example Git Branching Diagram

You can use this diagram as a template to create your own git branching diagrams. Here's how:

  1. Create a new diagram with diagrams.net (formerly draw.io)
  2. Go to File > Open From > URL
  3. Insert this url (it points to the xml data below): https://gist.githubusercontent.com/bryanbraun/8c93e154a93a08794291df1fcdce6918/raw/bf563eb36c3623bb9e7e1faae349c5da802f9fed/template-data.xml
  4. Customize as needed for your team.

@vtenq
vtenq / git-workflow.md
Last active July 26, 2024 16:50
Git workflow with conventional commits and semantic auto release

Git workflow with conventional commits and semantic auto release

This is an adoptation of Git flow by Vincent Driessen with conventional commits and semantic release.

The main concepts

At the core, the development model is greatly inspired by existing models out there. The central repo holds two main branches with an infinite lifetime:

@leek
leek / _Magento2_DeleteTestData.md
Last active July 25, 2024 12:46
Magento 2 - Delete All Test Data

These set of scripts are for Magento 2. For Magento 1, see this Gist.

@abc873693
abc873693 / taiwan_districts.json
Last active March 26, 2024 03:40
台灣行政區郵遞區號 JSON
[
{
"districts": [
{
"zip": "100",
"name": "中正區"
},
{
"zip": "103",
"name": "大同區"
@danilkuznetsov
danilkuznetsov / Export data from H2 database into CSV
Last active June 14, 2023 00:23
Export data from H2 database into CSV
CALL CSVWRITE('/home/<user>/downloads/<table_name>'.csv', 'SELECT * FROM <table_name>', 'charset=UTF-8 fieldSeparator=;');
Without field delimiter "
CALL CSVWRITE('/home/<user>/downloads/<table_name>'.csv', 'SELECT * FROM <table_name>', 'charset=UTF-8 fieldSeparator=; fieldDelimiter=');
@aaronanderson
aaronanderson / S3Util.java
Last active February 6, 2024 10:52
Workaround to create presigned S3 URL using the new aws-sdk-java-v2 library preview
//updated for 2.0.0-preview-11
import java.io.ByteArrayInputStream;
import java.net.URI;
import java.time.Duration;
import java.time.Instant;
import java.util.Optional;
import software.amazon.awssdk.auth.signer.AwsS3V4Signer;
import software.amazon.awssdk.auth.signer.internal.AwsSignerExecutionAttribute;
@chrisdpa-tvx
chrisdpa-tvx / athena.rst
Last active March 20, 2022 06:28
Create an Athena database, table, and query

All Your Data Does Not Belong In a Database

Businesses are machines producing mountains of data about sales, usage, customer, costs, etc... Traditionally data processing is highly centralised with teams of staff and computer running hot a whirling ready to process. We can do better than moving the mountain of data into the corporate data machine - so long as that machinary is light enough to be moved to the data.

Don't move the mountain - Bring the processing to the data

We've had this problem; a huge directory of files in CSV format, conataining vital information for our business. But it's in CSV, requires analysis, and don't you don't feel like learning sed/grep/awk today - besides it's 2017 and no-one thinks those tools are easy to use.

@inadarei
inadarei / minikube-sierra.md
Last active October 20, 2020 01:57
Minikube Setup: Docker for Mac / Sierra

Prerequisite: latest Docker for Mac on MacOS Sierra

$ brew update
$ brew install --HEAD xhyve
$ brew install docker-machine-driver-xhyve
$ sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
$ sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve

$ curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.18.0/minikube-darwin-amd64 &amp;&amp; chmod +x minikube &amp;&amp; sudo mv minikube /usr/local/bin/