A set of snippets I use in Laravel Nova
cd ./nova
yarn
mv webpack.mix.js.dist webpack.mix.js| # SETUP # | |
| DOMAIN=example.com | |
| PROJECT_REPO="git@github.com:example.com/app.git" | |
| AMOUNT_KEEP_RELEASES=5 | |
| RELEASE_NAME=$(date +%s--%Y_%m_%d--%H_%M_%S) | |
| RELEASES_DIRECTORY=~/$DOMAIN/releases | |
| DEPLOYMENT_DIRECTORY=$RELEASES_DIRECTORY/$RELEASE_NAME | |
| # stop script on error signal (-e) and undefined variables (-u) |
| # EDIT 10/04/2022 - This version was provided by @jayelm who fixed some bugs and made the function much more robust | |
| import os | |
| import subprocess | |
| import time | |
| def assign_free_gpus(threshold_vram_usage=1500, max_gpus=2, wait=False, sleep_time=10): | |
| """ | |
| Assigns free gpus to the current process via the CUDA_AVAILABLE_DEVICES env variable | |
| This function should be called after all imports, |
| public static function form(Form $form): Form | |
| { | |
| return $form | |
| ->schema([ | |
| Forms\Components\Grid::make() | |
| ->schema([ | |
| Forms\Components\Card::make() | |
| ->schema([ | |
| Forms\Components\TextInput::make('name') | |
| ->required() |
#Country ban with UFW#
Grab your different country ip addresses and save as Linux IPTables
http://www.ip2location.com/free/visitor-blocker
##Add country## Run the following command
| <?php | |
| class Bar extends Eloquent { | |
| public function foo() { | |
| return $this->belongsTo('Foo'); | |
| } | |
| } |
| wan_interface=ens32 | |
| lan_interface=ens33 | |