Skip to content

Instantly share code, notes, and snippets.

@chrisdiana
chrisdiana / my-counter.js
Created May 24, 2021
Web Component Example
View my-counter.js
const template = document.createElement('template');
template.innerHTML = `
<style>
* {
font-size: 200%;
}
span {
width: 4rem;
display: inline-block;
@chrisdiana
chrisdiana / mosh-macos.md
Last active Oct 3, 2021
Getting mosh server running on macOS Catalina
View mosh-macos.md

Running into this error message when trying to run a mosh server on macOS Catalina? The steps below should solve the problem which is most likely either a $PATH and/or firewall issues.

command not found: mosh-server
Connection to X.X.X.X closed.
/usr/local/bin/mosh: Did not find mosh server startup message. (Have you installed mosh on your server?)

1. Install Mosh

@chrisdiana
chrisdiana / export-cognito-users.sh
Last active Sep 13, 2021
Export AWS Cognito User Pool
View export-cognito-users.sh
# Export as Text Table
aws --region XXXXXXXXX cognito-idp list-users --user-pool-id XXXXXXXXXXXXX --output table > ~/users.txt
# Export as JSON
aws --region XXXXXXXXX cognito-idp list-users --user-pool-id XXXXXXXXXXXXX --output json > ~/users.json
# Export User Pool with more than 60 users (pagination)
aws --region XXXXXXXXX cognito-idp list-users --user-pool-id XXXXXXXXXXXXX --pagination-token INCREDIBLYLONGSTRINGHERE --output json > ~/users-2.json
@chrisdiana
chrisdiana / gist:ac64daf20d405b33d7a6
Last active Sep 10, 2021
PHP Login without Database
View gist:ac64daf20d405b33d7a6
<?php
session_start();
// ***************************************** //
// ********** DECLARE VARIABLES ********** //
// ***************************************** //
$username = 'username';
$password = 'password';
@chrisdiana
chrisdiana / amazon_linux_ec2_starter.sh
Last active Sep 7, 2021
Amazon Linux EC2 Starter
View amazon_linux_ec2_starter.sh
sudo yum update -y
sudo yum install -y tmux vim docker htop wget git w3m python3 htop curl
sudo service docker start
sudo usermod -a -G docker ec2-user
sudo pip3 install virtualenv
virtualenv -p python3 venv
aws configure
sudo systemctl enable docker
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
. ~/.nvm/nvm.sh
@chrisdiana
chrisdiana / large-scale-vue.md
Created Mar 15, 2019
Large Scale Vue Application Structure
View large-scale-vue.md

Large Scale Vue Application Structure

Application Structure LIFT Principle

  • Locating our code is easy
  • Identify code at a glance
  • Flat structure as long as we can
  • Try to stay DRY (Don’t Repeat Yourself) or T-DRY

"Folders-by-Feature" Structure

@chrisdiana
chrisdiana / index.html
Last active Aug 21, 2021
Simple Vue / Vuetify Template
View index.html
<!DOCTYPE html>
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@4.x/css/materialdesignicons.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
</head>
<body>
<div id="app">
@chrisdiana
chrisdiana / opz.md
Last active Jul 13, 2021
OP-Z Cheatsheet
View opz.md

General

  • Play: Press Play
  • Stop: Press Stop
  • Sequence: Hold Trig + key
  • Sequence v2: Hold Rec + keys
  • Live Record: Hold Rec + Play + key/Play
  • Stop Recording: Press Rec

Global

  • Metronome Volume: Hold M + Red Dial
@chrisdiana
chrisdiana / python-application-structures.md
Last active Jul 8, 2021
Python Application Structures
View python-application-structures.md

One-Off Script

helloworld/
│
├── .gitignore
├── helloworld.py
├── LICENSE
├── README.md
├── requirements.txt
@chrisdiana
chrisdiana / InstallChrome.ps1
Last active Jun 18, 2021
Install Chrome on Windows
View InstallChrome.ps1
$LocalTempDir = $env:TEMP; $ChromeInstaller = "ChromeInstaller.exe"; (new-object System.Net.WebClient).DownloadFile('http://dl.google.com/chrome/install/375.126/chrome_installer.exe', "$LocalTempDir\$ChromeInstaller"); & "$LocalTempDir\$ChromeInstaller" /silent /install; $Process2Monitor = "ChromeInstaller"; Do { $ProcessesFound = Get-Process | ?{$Process2Monitor -contains $_.Name} | Select-Object -ExpandProperty Name; If ($ProcessesFound) { "Still running: $($ProcessesFound -join ', ')" | Write-Host; Start-Sleep -Seconds 2 } else { rm "$LocalTempDir\$ChromeInstaller" -ErrorAction SilentlyContinue -Verbose } } Until (!$ProcessesFound)