Skip to content

Instantly share code, notes, and snippets.

View Weiyuan-Lane's full-sized avatar
🐈
Code. Code! CODE! CODE!!!!!!

Weiyuan Liu Weiyuan-Lane

🐈
Code. Code! CODE! CODE!!!!!!
View GitHub Profile
@Weiyuan-Lane
Weiyuan-Lane / file_write_results_10_chunks_mem.txt
Created February 15, 2021 18:41
Comparison of file writing strategies
Write all lines to file at once, mode "w"
1.651B memsize ( 0.000 retained)
75.008k objects ( 0.000 retained)
50.000 strings ( 0.000 retained)
Write all lines to file at once, mode "a"
1.651B memsize ( 40.000 retained)
75.008k objects ( 1.000 retained)
50.000 strings ( 0.000 retained)
Write all lines to file at once, mode "w+"
1.651B memsize ( 40.000 retained)
package example_test
import (
"testing"
"some-repo/example"
)
func TestHelloWorld(t *testing.T) {
if example.HelloWorld() != 10 {
t.Errorf("hello world did not hello properly")
expect(pageParams).to receive(:getPage)
.with(no_args)
.and_return(10)
@Weiyuan-Lane
Weiyuan-Lane / notaclass.go
Created January 30, 2021 12:37
This shows usage of receiver methods for a custom type that is not a struct
package main
import (
"fmt"
)
type Weirdtype func(string)
func (w Weirdtype) Println(statement string) {
fmt.Println("Receiver:", statement)
@Weiyuan-Lane
Weiyuan-Lane / Makefile
Last active February 3, 2021 02:23
Makefile with tasks for testing
TMP_COVER_FILE="/tmp/go-cover.tmp"
TMP_COVER_HTML_FILE="/tmp/index.html"
run_tests:
@echo -e "\n\n\n======================="
@echo -e "Running full test suite"
@echo -e "=======================\n"
@go test -cover ./... | sed ''/^ok/s//$$(printf "\033[32mok\033[0m")/'' | sed ''/^?/s//$$(printf "\033[33m-\033[0m")/'' | sed ''/^FAIL/s//$$(printf "\033[31mFAIL\033[0m")/''
coverage:
@Weiyuan-Lane
Weiyuan-Lane / Test.java
Created January 26, 2021 17:44
Nested classes for java
public class Test {
public class NestedOne {
// ...
}
static public class NestedTwo {
// ...
}
}
DevOps (philosophy) SRE (implementation)

Reduce organizational silos


Share ownership (and responsibility) of systems with developers, and utilizing the same tools and metrics/SLOs for measuring reliability.


Accept failure as normal

Failure is accepted as inevitable when practicing SRE, and we should conduct blameless postmortems so as to identify, solve, and prevent the same issues from happening again. This can be done by:

1. Fostering psychological safety to encourage discourse on failures, without any fear of punishment.

2. Document all details of the incident, such as the time of occurrence, recovery time, impact to users, root cause, short term fixes, and follow up actions to fix in the long term.

3. Review the post-mortem ticket, continue discourse if necessary, and take follow up actions when possible.

Implement gradual change Encourage frequent but small deployments to smaller subsets of u
@Weiyuan-Lane
Weiyuan-Lane / sqq.md
Last active November 8, 2020 13:43
Selected Qwiklabs Quests
Quests (and link) Difficulty Topics
Google Cloud Essentials Introductory Compute Engine Remote Desktop Kubernetes Engine Network
Deploying Applications Introductory App Engine Kubernetes Engine Firebase Apigee
Baseline: Data, ML, AI Introductory Dataprep Dataflow Dataproc
Cloud Architecture Fundamental Kubernetes Engine Network Deployment Manager Cloud Monitoring Spinnaker
Cloud SQL Fundamental Cloud SQL App Engine Deployment Manager Terraform
DevOps Essentials Fundamental Cloud Source Repositories Kubernetes Engine Terraform Cloud Monitoring
Security & Identity Fundamentals Fundamental IAM IAP KMS Network `K
@Weiyuan-Lane
Weiyuan-Lane / omo.md
Last active November 9, 2020 04:30
One Month of Festivities - Devfest 2020