See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope>
is optional
from djangobb_forum.models import Post | |
from django.db.models import Max | |
# id__max is None if there are no Posts in the database | |
id_max = Post.objects.all().aggregate(Max('id'))['id__max'] | |
id_next = id_max + 1 if id_max else 1 |
def multireplace(string, replacements, ignore_case=False): | |
""" | |
Given a string and a replacement map, it returns the replaced string. | |
:param str string: string to execute replacements on | |
:param dict replacements: replacement dictionary {value to find: value to replace} | |
:param bool ignore_case: whether the match should be case insensitive | |
:rtype: str | |
""" |
# This guide is based on https://wiki.archlinux.org/index.php/User:Altercation/Bullet_Proof_Arch_Install | |
# compare for more details on each step. It's a great guide and seems to get frequent updates. | |
# This guide has a few changes that helped me to get thew bootloader running | |
# Start up the Live USB/CD and enable SSH: | |
# set a password for root to enable ssh login | |
# * | |
passwd | |
systemctl start sshd.service |
# https://hakibenita.com/fast-load-data-python-postgresql | |
from typing import Iterator, Dict, Any, Optional | |
from urllib.parse import urlencode | |
import datetime | |
#------------------------ Profile | |
import time |
# inspired by https://github.com/junegunn/fzf/issues/868 | |
function __fzf_ls_files | |
git ls-tree -r --name-only HEAD 2>/dev/null; or fd --type f --hidden --follow --exclude .git | |
end | |
function __fzf_grep_last | |
set -l cmd (commandline) | |
# default complete all, and compatible with fzf `**<TAB>` | |
if str_endswith "$cmd" ' '; or test $cmd = '**' |
Updated: Jun 17, 2022
Chromium: 102.0.5005.115 (Official Build) (64-bit) (cohort: Stable)
OS: Windows 10 Version 21H2 (Build 19044.1766)
Overrides the built-in software rendering list and enables GPU-acceleration on unsupported system configurations. – Mac, Windows, Linux, Chrome OS, Android
using namespace System.Management.Automation | |
using namespace System.Management.Automation.Language | |
if ($host.Name -eq 'ConsoleHost') | |
{ | |
Import-Module PSReadLine | |
} | |
#Import-Module PSColors | |
#Import-Module posh-git | |
Import-Module -Name Terminal-Icons |
#!/bin/bash | |
# Put under /etc/autoMemoryReclaim.sh | |
# set variables at the top | |
low_cpu_usage=50 # Note: We work with integer percentages (e.g., 50%) | |
idle_time=2 # Minutes | |
cached_memory_limit=1000 # MB | |
percent_memory_to_reclaim=5 # Percentage as an integer | |
wait_period=3 |