// `table A` is filled with rows of data that contain a reference key to the `id` column of `table B`
// we need to rows with the most occurrences of reference keys, then return the data from the matching row in `table B`
// for instance,
// `table A` are newspapers, and `table B` are countries
// `table A` might look like
// name | key
This file contains 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
less /var/log/mysql/error.log | |
free -m | |
mysqltuner | |
tail -f /var/log/apache2/error.log | |
#!/bin/bash | |
SERVERIP=192.168.2.3 | |
NOTIFYEMAIL=test@example.com | |
ping -c 3 $SERVERIP > /dev/null 2>&1 |
This file contains 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
# working with text in bash | |
# paste string into a text file | |
echo string > textfile | |
# export stdout to a text file | |
command > textfile | |
# copy contents of a text file | |
cat filename > /dev/clipboard |
This file contains 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
<!-- vertically-aligned center and bottom boxes in a column with flex box --> | |
<div class="container"> | |
<div class="center"> | |
<span>center</span> | |
</div> | |
<div class="bottom"> | |
<span>bottom</span> | |
</div> |
This file contains 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
// git init --bare | |
// cd hooks && touch post-receive && cat /dev/clipboard > post-receive && chown USER:GROUP post-receive | |
#!/bin/bash | |
# forked from | |
# https://gist.github.com/noelboss/3fe13927025b89757f8fb12e9066f2fa#file-post-receive | |
TARGET="/var/www/html/" | |
GIT_DIR="/var/www/html/REPOSITORY.git" | |
BRANCH="production" |
This file contains 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
class API { | |
private $path; | |
private $length; | |
private $route; | |
private $db; | |
function __construct(array $options) { | |
This file contains 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 | |
if [[$1 == "export"]] | |
then mysqldump -u $2 $3 > "$3.sql"; | |
fi | |
if [[$1 == "import"]] | |
then mysql -u $2 $3 < "$3.sql"; | |
fi | |
This file contains 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
<?php | |
//https://gist.github.com/taniarascia/013fb512078329cc6c40f4e4bf98fdbf | |
class MysqlDriver { | |
private $host; | |
private $dbname; | |
private $username; | |
private $password; | |
private $charset; | |
private $collate; |
This file contains 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
#!/usr/bin | |
# https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-ubuntu-18-04 | |
sudo apt install php libapache2-mod-php php-mysql | |
sudo nano /etc/apache2/mods-enabled/dir.conf | |