Skip to content

Instantly share code, notes, and snippets.

@brndnsmth
brndnsmth / django-project-structure.md
Created March 10, 2024 20:06
Django Project Structure - Modular App Design

Django Project Structure - Modular App Design

A small project today could lead to its expansion with additional functionalities, necessitating separate applications. As you incorporate more features, the views.py file might swell with disparate code segments, complicating navigation and comprehension. It’s preferable to manage a concise, 200-line views.py file focused solely on your store app rather than wading through over a thousand lines of unrelated code.

Collaborative efforts benefit from modularization, as it simplifies task delegation among developers.

Modular apps enhance the flexibility of your codebase, allowing for straightforward integration or detachment from your current or future projects.

Suggested Directory Structure - Position all applications within an apps/ subdirectory to maintain an uncluttered root directory. This approach aids in the immediate recognition and understanding of the project’s framework and layout.

@brndnsmth
brndnsmth / pip-compile.md
Last active March 9, 2024 15:00
Setting Up a Python Project Environment with pip-tools

Setting Up a Python Project Environment with pip-tools

This guide will walk you through the process of setting up a Python project environment using pip-tools, a set of command-line tools designed to complement pip. You can find more information about pip-tools on their GitHub repository.

https://github.com/jazzband/pip-tools

Step 1: Create a Virtual Environment

A virtual environment is an isolated Python environment that allows you to manage dependencies for different projects separately. To create a virtual environment, run the following commands in your terminal:

@brndnsmth
brndnsmth / semantic-commit-messages.md
Created February 12, 2024 22:29 — forked from joshbuchea/semantic-commit-messages.md
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@brndnsmth
brndnsmth / go-commands.txt
Last active March 9, 2024 15:01
go commands
// Usual process
mkdir project-name
cd project-name
git mod init github.com/brndnsmth/project-name
go get -u gorm.io/gorm // example install
go get -u gorm.io/driver/sqlite // example install
go mod tidy
go run main.go
// Set install directory for all go modules

Electron is tricky to get set up on Windows Subsystem for Linux, but it can work!

Four things needed overall:

  1. you need WSL2, not WSL1
  2. you need node, of course, and that part isn't so bad
  3. you need to apt install several dependencies
  4. you need an X Server so it can display the electron GUI over in Windows-land

Setup instructions, in order:

@brndnsmth
brndnsmth / multiple_git_configs.md
Created September 11, 2023 14:11
Use Multiple Git Configs on One Computer

Use Multiple Git Configs on One Computer

Create a global Git config

$HOME/.gitconfig

[includeIf "gitdir:~/personal/"]
  path = ~/.gitconfig-personal
[includeIf "gitdir:~/work/"]
@brndnsmth
brndnsmth / explorer_wsl.md
Last active September 11, 2023 14:13
Open the Current Directory in Windows Explorer from WSL

Opening the Current Directory in Windows Explorer from WSL

If you're working within the Windows Subsystem for Linux (WSL) and need to open the current directory in Windows Explorer, you can use the following commands. WSL automatically sets the Windows path for you.

explorer.exe .

This command will launch Windows Explorer with the current directory open.

Create an Alias for Convenience:

@brndnsmth
brndnsmth / nvmCommands.js
Created September 10, 2023 19:26
Useful NVM commands / cheatsheet
// check version
node -v || node --version
// list locally installed versions of node
nvm ls
// list available versions of node
nvm ls-remote
// list latest versions of node
@brndnsmth
brndnsmth / private_fork.md
Created July 30, 2023 18:31 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git