Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| from django.contrib import admin | |
| class ReadOnlyModelAdmin(admin.ModelAdmin): | |
| """ | |
| ModelAdmin class that prevents modifications through the admin. | |
| The changelist and the detail view work, but a 403 is returned | |
| if one actually tries to edit an object. |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| ssh admin@nas | |
| /etc/init.d/services.sh stop | |
| /etc/init.d/xdove.sh stop | |
| # See if there are still files open on the disk: | |
| lsof |grep /share/MD0_DATA | |
| # Kill the open processes if any. |
| #!/bin/bash | |
| #YouTube OAuth authentication for shell-based YT-tools like youtube-dl | |
| #by untergrundbiber 2014 | |
| #You need to register a app to obtaining clientId and clientSecret. | |
| #https://developers.google.com/youtube/registering_an_application | |
| #You can find the right scope here: https://developers.google.com/oauthplayground/ | |
| #--- Settings --- | |
| clientId="000000000000.apps.googleusercontent.com" |
| #!/bin/sh | |
| AUTHORIZED_KEYS=authorized_keys | |
| HOST_RSA_KEY=ssh_host_rsa_key | |
| SSHD=/usr/sbin/sshd | |
| PORT=8443 | |
| case "$AUTHORIZED_KEYS" in /*) ;; *) AUTHORIZED_KEYS=$PWD/$AUTHORIZED_KEYS ;; esac | |
| case "$HOST_RSA_KEY" in /*) ;; *) HOST_RSA_KEY=$PWD/$HOST_RSA_KEY ;; esac |
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| IFS=$'\n\t' | |
| LOG_GROUP_NAME="" | |
| LOG_STREAM_NAME="" | |
| REGION="" | |
| OUTPUT_FILE="$(date +"%Y%m%d").log" |
| import { useEffect, useRef } from 'react' | |
| export function useWhyDidYouUpdate(name: string, props: Record<string, any>) { | |
| const latestProps = useRef(props) | |
| useEffect(() => { | |
| const allKeys = Object.keys({ ...latestProps.current, ...props }) | |
| const changesObj: Record<string, { from: any; to: any }> = {} | |
| allKeys.forEach(key => { |