Skip to content

Instantly share code, notes, and snippets.

View lazercorn's full-sized avatar

Mike lazercorn

  • Google
View GitHub Profile
@lazercorn
lazercorn / clean_code.md
Created October 1, 2020 13:31 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@lazercorn
lazercorn / clean_code.md
Created October 1, 2020 13:31 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@lazercorn
lazercorn / network-tweak.md
Created January 2, 2020 03:50 — forked from mustafaturan/network-tweak.md
Linux Network Tweak for 2 million web socket connections

Sample config for 2 million web socket connection

    sysctl -w fs.file-max=12000500
    sysctl -w fs.nr_open=20000500
    # Set the maximum number of open file descriptors
    ulimit -n 20000000

    # Set the memory size for TCP with minimum, default and maximum thresholds 
 sysctl -w net.ipv4.tcp_mem='10000000 10000000 10000000'
@lazercorn
lazercorn / falsehoods-programming-time-list.md
Created October 4, 2019 08:08 — forked from timvisee/falsehoods-programming-time-list.md
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@lazercorn
lazercorn / custom_json.go
Created May 16, 2019 08:29 — forked from mdwhatcott/custom_json.go
Example of implementing MarshalJSON and UnmarshalJSON to serialize and deserialize custom types to JSON in Go. Playground: http://play.golang.org/p/7nk5ZEbVLw
package main
import (
"bytes"
"encoding/json"
"fmt"
"strconv"
)
func main() {
@lazercorn
lazercorn / struct_custom_unmarshal.go
Created May 16, 2019 08:28 — forked from miguelmota/struct_custom_unmarshal.go
Golang custom struct unmarshal function example
package main
import (
"encoding/json"
"fmt"
"log"
"time"
)
type MyStruct struct {
@lazercorn
lazercorn / idea64.exe.vmoptions
Created March 3, 2019 00:31 — forked from edwardbeckett/idea64.exe.vmoptions
Java 8 Intellij 64 JVM Options
-server
-Xms2g
-Xmx2g
-Xss16m
-XX:+UseConcMarkSweepGC
-XX:+CMSParallelRemarkEnabled
-XX:ConcGCThreads=4
-XX:ReservedCodeCacheSize=128m
-XX:+AlwaysPreTouch
-XX:+TieredCompilation
@lazercorn
lazercorn / vmOptions
Created March 3, 2019 00:17 — forked from JosiasSena/vmOptions
Preffered android studio VM options
-Xms512m
-Xmx3g
-XX:MaxPermSize=2g
-XX:ReservedCodeCacheSize=1g
-XX:+UseCompressedOops
@lazercorn
lazercorn / studio64.exe.vmoptions
Created March 3, 2019 00:16 — forked from haydarai/studio64.exe.vmoptions
My custom Android Studio VM options
# custom Android Studio VM options
#
# *DO NOT* modify this file directly. If there is a value that you would like to override,
# please add it to your user specific configuration file.
#
# See http://tools.android.com/tech-docs/configuration
#
-server
-Xms1G