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
@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:
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
@phptek
phptek / IPFS
Last active December 12, 2018 23:27
1. Censorship resistant resource access.
Govts turn off the internet. (Egypt 2014). Use of peer to peer resource access allows N geographically proximate users accesss to the same file or resources, assuming at least one peer has downloaded them already, for everyone else to get it through them.
2. Broken Links.
The original tenets of the web are violated daily: Links to corporate-supplied services and resources are taken down when censored or when that service goes down or when that corporate goes out of business, or when a hitherto free resource is hidden behind a paywall. Burning books anyone?
3. Verifiability.
@phptek
phptek / depcheck.sh
Created November 29, 2018 20:17
Shell script to check for security vulnerabilities in composer and node deps
#!/bin/bash
#
# Russell Michell 2018 <[email protected]>
#
# What is this?
#
# Provides an indication of any security vulnerabilities in a project's composer and npm dependencies
errors_npm=0
errors_cmp=0