Skip to content

Instantly share code, notes, and snippets.

@dmwyatt
dmwyatt / knownpaths.py
Created January 28, 2022 17:41 — forked from mkropat/knownpaths.py
Python wrapper around the SHGetKnownFolderPath Windows Shell function
import ctypes, sys
from ctypes import windll, wintypes
from uuid import UUID
class GUID(ctypes.Structure): # [1]
_fields_ = [
("Data1", wintypes.DWORD),
("Data2", wintypes.WORD),
("Data3", wintypes.WORD),
("Data4", wintypes.BYTE * 8)
@dmwyatt
dmwyatt / serializers.py
Created October 27, 2020 03:14 — forked from Joel-hanson/serializers.py
Advanced serializer usage - Dynamically modifying fields
from rest_framework.serializers import ModelSerializer, SerializerMethodField
from .models import Book, Publisher, Author
class PublisherModelSerializer(ModelSerializer):
"""
A ModelSerializer that takes an additional `fields` argument that
controls which fields should be displayed.
"""
def __init__(self, *args, **kwargs):
@dmwyatt
dmwyatt / byobu_cheatsheet.txt
Last active December 6, 2019 18:12 — forked from devhero/byobu_cheatsheet
[byobu cheatsheet] (from F9 -> quick start guide)
http://askubuntu.com/questions/661940/i-just-dont-get-byobus-keybindings-systems-or
Byobu is a suite of enhancements to tmux, as a command line
tool providing live system status, dynamic window management,
and some convenient keybindings:
F1 * Used by X11 *
Shift-F1 Display this help
F2 Create a new window
Shift-F2 Create a horizontal split
@dmwyatt
dmwyatt / keypass-setup-and-sync.md
Last active December 6, 2019 18:10 — forked from cmcginty/keypass-setup-and-sync.md
[KeePass2 Password Manager Settings and Auto-Synchronization] #keepass

KeePass2 Setup and Auto-Synchronization Guide

KeePass is a password management utility for Windows, Linux, and Mac.

The first section describes the steps needed to setup KeyPass2 in Linux and how to add FireFox and Chrome plugin integrations.

The (optional) second section documents a robust way to automatically synchronize the password DB across multiple devices.

@dmwyatt
dmwyatt / Using Github Deploy Key.md
Last active March 26, 2022 12:31 — forked from zhujunsan/Using Github Deploy Key.md
[Using Github Deploy Key] #github

What / Why

Deploy key is a SSH key set in your repo to grant client read-only (as well as r/w, if you want) access to your repo.

As the name says, its primary function is to be used in the deploy process, where only read access is needed. Therefore keep the repo safe from the attack, in case the server side is fallen.

How to

  1. Generate a ssh key
@dmwyatt
dmwyatt / sheet.py
Last active December 6, 2019 18:54 — forked from miohtama/sheet.py
[gsheet examples] Creating and sharing Google Sheet spreadsheets using Python #google
"""Google spreadsheet related.
Packages required: gspread, cryptography, oauth2client, google-api-python-client
For OSX see
* http://stackoverflow.com/a/33508676/315168
"""
import logging