- Pastebot
- GIF Brewery
- Slack
- Keynote/Pages/Numbers
- 1Password
- OmniFocus 3
- Airmail 3
- iA Writer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
LOG_GROUP_NAME="" | |
LOG_STREAM_NAME="" | |
REGION="" | |
OUTPUT_FILE="$(date +"%Y%m%d").log" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |