Skip to content

Instantly share code, notes, and snippets.

@erikyuzwa
erikyuzwa / wordpress-6-2-2-docker-compose.yml
Last active May 11, 2024 07:13
Wordpress 6.2.2 Docker Compose for Local Development
# create a local .env file with the following 4 properties:
#
# MYSQL_DATABASE=<something>
# MYSQL_USER=<something>
# MYSQL_PASSWORD=<something>
# MYSQL_ROOT_PASSWORD=<something>
#
# Note: I have had a LOT of issues working with anything newer then Docker Desktop v4.26.1
# If you're on something newer, then double check against this release.
#
@matusnovak
matusnovak / README.md
Last active May 11, 2024 07:10
GPG + Git SSH Authentication and Signing on Windows 10

GPG + Git SSH Authentication and Signing on Windows 10

Introduction

This simple Gist will explain how to settup your GPG key to work for SSH authentication (with Git) and Git commit signing on Windows 10. This may seem straightforward on Linux, but there are certain tweaks needed on Windows.

No Cygwin, no MinGW, no Git Bash or any other Linux emulated environment. This works in pure Windows 10.

Software needed

@wojteklu
wojteklu / clean_code.md
Last active May 11, 2024 07:08
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@the-bass
the-bass / rename_state_dict_keys.py
Last active May 11, 2024 07:07
Rename the parameters of a PyTorch module's saved state dict. Last tested with PyTorch 1.0.1.
import torch
from collections import OrderedDict
def rename_state_dict_keys(source, key_transformation, target=None):
"""
source -> Path to the saved state dict.
key_transformation -> Function that accepts the old key names of the state
dict as the only argument and returns the new key name.
target (optional) -> Path at which the new state dict should be saved

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@RobTrew
RobTrew / soundDeviceToggle.js
Last active May 11, 2024 07:04
Toggling OS X Sound Output Devices with JXA Javascript for Automation (OS X 10.10)
// Rob Trew @complexpoint 2015
function run() {
"use strict";
var blnUseKeyboardMaestro = false;
// EDIT TO NAMES OF TWO ALTERNATIVE SOUND OUTPUT DEVICES
var dctSources = { // A unique substring for each is enough
primary: "Internal",
secondary: "Elgato"
@bryanbraun
bryanbraun / git-branching-diagram.md
Last active May 11, 2024 07:03
Example Git Branching Diagram

Example Git Branching Diagram

You can use this diagram as a template to create your own git branching diagrams. Here's how:

  1. Create a new diagram with diagrams.net (formerly draw.io)
  2. Go to File > Open From > URL
  3. Insert this url (it points to the xml data below): https://gist.githubusercontent.com/bryanbraun/8c93e154a93a08794291df1fcdce6918/raw/bf563eb36c3623bb9e7e1faae349c5da802f9fed/template-data.xml
  4. Customize as needed for your team.

@DavFount
DavFount / AutoDBBackup.ps1
Last active May 11, 2024 07:03
Auto-Backup MariaDB Database (Windows)
param(
[Parameter(Mandatory, HelpMessage = 'Path to Maria DB Installation. C:\Program Files\MariaDB 10.9')]
[string]$SQLPath,
[Parameter(Mandatory, HelpMessage = 'Location to store backups. C:\DBServerBackups')]
[string]$BackupDirectory,
[Parameter(Mandatory, HelpMessage = 'SQL User with access to your DB.')]
[string]$User,
[Parameter(Mandatory, HelpMessage = 'Password for the SQL User.')]
[string]$Pass,
[Parameter(HelpMessage = 'Port Number for your SQL Instance. Default: 3306')]
@RobTrew
RobTrew / KMVars.js
Last active May 11, 2024 07:02
Example: accessing Keyboard Maestro variables from Yosemite JXA Javascript for Applications
function run() {
// KEYBOARD MAESTRO VARIABLES IN YOSEMITE JXA JAVASCRIPT FOR APPLICATIONS
// FINDING, CREATING, READING, UPDATING
// SIMPLE EXAMPLE - TOGGLING A BOOLEAN KM VARIABLE FROM .js
var strKMVarName = "flag";