This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Let us consider the following typical mysql backup script: | |
| mysqldump --routines --no-data -h $mysqlHost -P $mysqlPort -u $mysqlUser -p$mysqlPassword $database | |
| # It succeeds but stderr will get: | |
| # Warning: Using a password on the command line interface can be insecure. | |
| # You can fix this with the below hack: | |
| credentialsFile=/mysql-credentials.cnf | |
| echo "[client]" > $credentialsFile | |
| echo "user=$mysqlUser" >> $credentialsFile | |
| echo "password=$mysqlPassword" >> $credentialsFile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Two dashes start a one-line comment. | |
| --[[ | |
| Adding two ['s and ]'s makes it a | |
| multi-line comment. | |
| --]] | |
| ---------------------------------------------------- | |
| -- 1. Variables and flow control. | |
| ---------------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://bosnadev.com/2014/09/12/install-elasticsearch-on-laravel-homestead/ | |
| # https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html | |
| # https://www.elastic.co/blog/elasticsearch-unplugged | |
| # Install Java | |
| sudo apt-get install openjdk-7-jre-headless -y | |
| # Download & install the Public Signing Key | |
| wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Add a 401 response interceptor | |
| window.axios.interceptors.response.use(function (response) { | |
| return response; | |
| }, function (error) { | |
| if (401 === error.response.status) { | |
| swal({ | |
| title: "Session Expired", | |
| text: "Your session has expired. Would you like to be redirected to the login page?", | |
| type: "warning", | |
| showCancelButton: true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let mix = require("laravel-mix"); | |
| let tailwindcss = require("tailwindcss"); | |
| let glob = require("glob-all"); | |
| let PurgecssPlugin = require("purgecss-webpack-plugin"); | |
| /** | |
| * Custom PurgeCSS Extractor | |
| * https://github.com/FullHuman/purgecss | |
| * https://github.com/FullHuman/purgecss-webpack-plugin | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ########## Install NGINX ############## | |
| # Install software-properties-common package to give us add-apt-repository package | |
| sudo apt-get install -y software-properties-common | |
| # Install latest nginx version from community maintained ppa | |
| sudo add-apt-repository ppa:nginx/stable | |
| # Update packages after adding ppa |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from scipy.sparse import csr_matrix | |
| import scipy as sp | |
| import numpy as np | |
| from scipy.sparse.linalg import spsolve_triangular | |
| # rating matrix | |
| a = np.array([[1, 0, 1, 1, 0], | |
| [1, 1, 0, 1, 0], | |
| [1, 0, 0, 1, 0]]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # project: build_oct | |
| # version: 1.12 (2023-01-01) | |
| # authors: C. Himpe (0000-0003-2194-6754), M. Koehler (0000-0003-2338-9904) | |
| # license: BSD-2-Clause License (opensource.org/licenses/BSD-2-Clause) | |
| # summary: Build Octave and numerical dependencies from source (in Ubuntu 20.04 with GCC >= 10.3). | |
| # requires hardware: either X86-64 with AVX2 or ARM64 with NEON. | |
| # requires software packages: octave libpcre2-dev libreadline-dev libgmp3-dev libmpfr-dev libfreetype6-dev libgl2ps-dev libfontconfig1-dev libglu1-mesa-dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #--------------------- | |
| # MAKE RECOMMENDATION | |
| #--------------------- | |
| def make_recommendation(user_id=None, num_items=10): | |
| """Recommend items for a given user given a trained model | |
| Args: | |
| user_id (int): The id of the user we want to create recommendations for. |
OlderNewer