A collection of commands that change the Arc Browser icon on macOS.
Theme | Command |
---|---|
Candy Arc | defaults write company.thebrowser.Browser currentAppIconName candy |
Organizing your Go (Golang) project's folder structure can help improve code readability, maintainability, and scalability. While there is no one-size-fits-all structure, here's a common folder structure for a Go project:
project-root/
├── cmd/
│ ├── your-app-name/
│ │ ├── main.go # Application entry point
│ │ └── ... # Other application-specific files
def program(): | |
from itertools import zip_longest | |
import zlib | |
import subprocess | |
class Display: | |
def __repr__(self) -> str: | |
subprocess.run([ | |
"feh", | |
"-xYFqZ", |
Ctrl + Alt + Space
#!/usr/bin/env python | |
# Before you run this script make sure Flask-SQLAlchemy is installed in | |
# your virtual environment | |
from flask import Flask | |
from flask_sqlalchemy import SQLAlchemy | |
app = Flask(__name__) | |
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' # in-memory |
# https://play.golang.org/p/JxqibtHkuO- | |
func chunkBy(items []string, chunkSize int) (chunks [][]string) { | |
for chunkSize < len(items) { | |
items, chunks = items[chunkSize:], append(chunks, items[0:chunkSize:chunkSize]) | |
} | |
return append(chunks, items) | |
} |
In the other file of this gist I detail why we should use struct{}
as context.Value() keys and not int
or string
. Open gist to see main.go
but the TLDR is:
type key struct{}
ctx = context.WithValue(ctx, key{}, "my value") // Set value
myValue, ok := ctx.Value(key{}).(string) // Get value
Git sees every file in your working copy as one of three things:
Ignored files are usually build artifacts and machine generated files that can be derived from your repository source or should otherwise not be committed. Some common examples are:
# Basic Makefile for Golang project | |
# Includes GRPC Gateway, Protocol Buffers | |
SERVICE ?= $(shell basename `go list`) | |
VERSION ?= $(shell git describe --tags --always --dirty --match=v* 2> /dev/null || cat $(PWD)/.version 2> /dev/null || echo v0) | |
PACKAGE ?= $(shell go list) | |
PACKAGES ?= $(shell go list ./...) | |
FILES ?= $(shell find . -type f -name '*.go' -not -path "./vendor/*") | |
# Binaries | |
PROTOC ?= protoc |
Implementation of different methods to calculate the Fibonacci numbers by fast doubling.
Please read my blog post for more detail.