Skip to content

Instantly share code, notes, and snippets.

db/models


Many to One -> FK -> db.models.ForeignKey

  • a Manufacturer makes multiple cars
  • lowercase of Class manufacturer
  • on_delete cascade, protect, set_null, set_default, set(), do_nothing
class Manufacturer(models.Model):
 # ...
  • Not the best choice feedback: “I don’t believe Solution A is the best choice, because XYZ. I believe Solution B would be better, but I accept that Solution A can work too.”
  • Fundamental flaws: “I believe Solution A is unacceptable because XYZ.”

A chair who asks, “Is everyone OK with choice A?” is going to get objections. But a chair who asks, “Can anyone not live with choice A?” is more likely to only hear from folks who think that choice A is impossible to engineer given some constraints. The objector might convince the rest of the group that the objections are valid and the working group might choose a different path.

If there is a good enough solution X, don’t ask people what they think about it. Instead, ask everyone if they can live with it and if not, why.

We risk more when we delay decisions in an attempt to reach total consensus.

#!/bin/sh
http --auth-type=jwt --auth=$1 127.0.0.1:$2/api/$3
#!/bin/bash
ICON=$HOME/.xlock/icon.png
TEMPBG=/tmp/screen.png
CMUS_STATUS=`cmus-remote -Q 2>/dev/null | head -1 | cut -d " " -f2`
if [ $CMUS_STATUS ]
then
cmus-remote -s
fi
#!/bin/sh
cmus-remote -Q 2>/dev/null | grep " title"| cut -d " " -f 3-20
# my alises
alias wtf='dmesg'
alias rtfm='man'
alias onoz='cat /var/log/errors.log'
alias :3='echo'
alias alwayz='tail -f'
alias goodn8='shutdown -h now'
alias frsh='shutdown -r now'

For web developers, this might include things like :

  •    MVC, MVVM, etc.
    
  •   Refactorings
    
  •   OOP principles
    
  •   Other paradigms like functional programming
    
  •   Application deployment
    
  •   Able to own features
    
  •   Beginning to lead communications with clients from time-to-time
    

For database developers, it might include:

  • Replication

Be explicit, use COPY over ADD

At first glance it looks like COPY and ADD does the same thing but there is a difference. ADD is able to extract TAR files as well, which COPY can't do. So be explicit and use COPY when you mean to copy files and ensure to only use ADD when you mean to use something feature specific like the mentioned TAR extraction.

@yzdann
yzdann / sed cheatsheet
Created May 22, 2019 09:35 — forked from ssstonebraker/sed cheatsheet
Sed Cheatsheet
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
# Created by newuser for 5.2
source ~/.antigen.zsh
source ~/.aliasly
# installing fzf with `apt install fzf`
# go
export PATH=$PATH:/usr/local/go/bin export GOPATH=$HOME/Dev/gokari
export PATH=$PATH:$GOPATH/bin
# virtualenv