Skip to content

Instantly share code, notes, and snippets.

View edwardzjl's full-sized avatar
🦝

Junlin Zhou edwardzjl

🦝
View GitHub Profile
@cbuckowitz
cbuckowitz / README.md
Last active July 6, 2024 05:52
Change Storage Location for Docker Desktop with WSL2 #DockerDesktop #WSL2

Change the Storage Location for Docker Desktop with WSL2

Docker Desktop stores docker data in 2 distros

  • docker-desktop
  • docker-desktop-data

These distros are installed on the system drive by default.

To move them to another drive, these distros can be exported, deleted and imported from the new location.

Two approaches to handle error responses from Spring WebClient calls globally:

  • Exceptions with webclients are all wrapped in WebClientResponseException class. So we can handle that using Spring's ExceptionHandler annotation.

  • Using ExchangeFilterFunction while constructing the webclient bean.

@Tamal
Tamal / git-ssh-error-fix.sh
Last active July 8, 2024 13:24
Solution for 'ssh: connect to host github.com port 22: Connection timed out' error
$ git clone git@github.com:xxxxx/xxxx.git my-awesome-proj
Cloning into 'my-awesome-proj'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
$ # This should also timeout
$ ssh -T git@github.com
ssh: connect to host github.com port 22: Connection timed out
$ # but this might work
@pitrk
pitrk / _mock_file_with_string.md
Last active November 15, 2023 13:34
Mock file with string in Python

Mock file with string in Python

This is an example on how to mock a file with string.

Use case

Testing a function which opens a file and does some kind of operation on it.

About the example

@claraj
claraj / gist:3b2b95a62c5ba6860c03b5c737c214ab
Created April 12, 2017 21:34
Custom JSON encoder for Flask
from flask import Flask
from flask import render_template
from flask import request
from flask import jsonify
import json
# This class tells Python how to turn a Delivery object into a JSON string.
# This class could encode various types of objects - use isinstance to check what type of thing it is, and return the appropriate JSON
# https://docs.python.org/3/library/json.html
@mikecroucher
mikecroucher / toree_on_ubuntu_16.04.md
Last active December 30, 2018 13:59
Installing Toree+Spark 2.1 on Ubuntu 16.04

Installing Toree+Spark 2.1 on Ubuntu 16.04

## 23rd January 2017

At the time of writing, the pip install of toree is not compatible with spark 2.x. We need to use the master branch from git.

Requirements

sudo apt install openjdk-8-jdk-headless
@bennAH
bennAH / mux_handlers.go
Created October 18, 2015 21:36
gorilla mux - multiple handlers
package main
import (
"fmt"
"github.com/gorilla/mux"
"net/http"
)
func main() {
r := mux.NewRouter()
@gavinhungry
gavinhungry / nginx-tls.conf
Last active July 18, 2024 11:35
Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Name: nginx-tls.conf
# Auth: Gavin Lloyd <gavinhungry@gmail.com>
# Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Enables HTTP/2, PFS, HSTS and OCSP stapling. Configuration options not related
# to SSL/TLS are not included here.
#
# Additional tips:
#