Skip to content

Instantly share code, notes, and snippets.

View phptek's full-sized avatar

Russ Michell phptek

View GitHub Profile
@phptek
phptek / nfs.sh
Last active April 21, 2022 01:53
Setup NFS on a Mac F/S
#!/usr/bin/env bash
OS=`uname -s`
if [ $OS != "Darwin" ]; then
echo "This script is OSX-only. Please do not run it on any other Unix."
exit 1
fi
if [[ $EUID -eq 0 ]]; then
FROM alpine:3.14
MAINTAINER AKQA 2022 <Wel.Tech@akqa.com>
ENV DOCROOT="/var/www/html/"
WORKDIR $DOCROOT
RUN apk update && apk upgrade
COPY .aws/foo-cron/hourly/* /etc/periodic/hourly/
@phptek
phptek / preferences.txt
Last active March 29, 2021 03:05
VSCode settings
- Open recent file (Not workspace)
* https://github.com/Microsoft/vscode/issues/49629
- DISABLE: Opening a file in a different location to my current location, the file hierarchy navigation will automatically drop to there
- CHECK: How to debug Python in VSCode
* See: https://github.com/microsoft/ptvsd/blob/master/TROUBLESHOOTING.md
Extensions:
DotEnv
PHP Intellisense
@phptek
phptek / Docker.txt
Created October 7, 2019 02:55
Docker basics
Dockerfile Best Practice:
* Keep no. RUN directoves to a minimum:
- Reduces filesize of generated image
- Ensures that changes to the command, regenerates the image properly (viz Dockerfile caching)
- Each command creates a new layer which is itself a separate image
* Security:
- Each service should have a dedicated user+group to use, to minimuse "leakage" from hacks in one service into other services
- Check snyk.io for additional security best-practices
* Images share commonalities, so makes sense ot use the same Base OS as the O/S' required by services themselves
......SHORTCUT ALL THE THINGS! OR
"STUFF YOU REALLY NEVER THOUGHT YOU NEEDED TO KNOW"...
Scenario: You have multiple _separate_ instances of the same window open e.g. Firefox or Chrome
Use: "alt + ~" to switch between them
Scenario: You have typed a long command, (or a short one with a long filename) and you need to change something at the end or the beginning:
@phptek
phptek / pgp
Last active August 15, 2019 20:22
List of PGP tools:
Link to Wikipedia: https://en.wikipedia.org/wiki/Pretty_Good_Privacy#Digital_signatures
CLI:
* gpg2
* https://www.linuxbabe.com/ubuntu/install-veracrypt-ubuntu-16-04-16-10
GUI:
@phptek
phptek / newcraptop
Created August 13, 2019 20:24
Rough laptop specs
Laptop:
* Webcam
* Headphone jack NOT on RHS
* 8Gb DDR3/4 RAM
* Core i5/i7
* >= 250Gb SSD
* 13-14" screen
* ~1.2Kg (Lenovo is 2kg)
* Chiclet keyboard
Add the following methods to your `Image` subclass to allow SVG uploads via `$has_one` `UploadField`'s and uploads via the Asset Admin.
Hat-tip to https://github.com/restruct/silverstripe-svg-images. All I've done is:
* Removed superfluous SVG template logic
* Called `isSVG()` from everywhere
* Added comments where appropriate
* Put all necessary YML config into one place
YML config:
#!/bin/bash
#
# Replace Eklektos' namespaces with the one used in your project.
#
# Run the following command from the directory containing your project's "app" or "mysite" directory:
#
# $> ./namespaceify.sh 'Foo\Bar' app
#
# This will convert for example: namespace Eklektos\Eklektos\Model\FooBar into: namespace Foo\Bar\Model\FooBar
@phptek
phptek / LND.txt
Created December 31, 2018 19:06
LND Setup
Docker image reqs
* Ubuntu Bionic
* go 1.11.x https://golang.org/doc/install?download=go1.11.4.linux-amd64.tar.gz
wget -O /tmp/go-1.11.4.tar.gz https://golang.org/doc/install?download=go1.11.4.linux-amd64.tar.gz \
tar -C /usr/local -xzf /tmp/go-1.11.4.tar.gz \
* php7.1
* nginx