Skip to content

Instantly share code, notes, and snippets.

View Guibzs's full-sized avatar

Joffrey Guibzs

View GitHub Profile
@Guibzs
Guibzs / .htaccess
Created February 7, 2020 20:23
HTACCESS - HTPASSWD
AuthName "Protected"
AuthType Basic
Require valid-user
AuthUserFile /ABSOLUTE_URL/.htpasswd
@Guibzs
Guibzs / views.sql
Last active January 25, 2019 13:07
MySQL ~ Views
CREATE OR REPLACE VIEW table_name AS
SELECT p.title, c.name FROM post AS p INNER JOIN category AS c ON p.category_id = c.ID;
@Guibzs
Guibzs / search
Created November 12, 2018 08:25
Bash ~ Search in files
@Guibzs
Guibzs / replace.sql
Last active August 27, 2019 09:09
MySQL ~ Replace
UPDATE table
SET column = REPLACE(column, ‘search’, ‘replace’);
@Guibzs
Guibzs / hide_show
Last active March 4, 2019 22:09
Hide/Show files & folders on macOS
defaults write com.apple.finder AppleShowAllFiles YES
defaults write com.apple.finder AppleShowAllFiles NO
@Guibzs
Guibzs / connection
Last active October 10, 2018 12:34
SSH commands
ssh username@hostname
@Guibzs
Guibzs / permisssions
Last active March 6, 2019 13:33
Bash ~ Change file permissions and ownership
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
chown -R root:root *;
sudo chown -R $(whoami) .
sudo chmod -R 777 .
@Guibzs
Guibzs / tar_gzip
Last active August 27, 2019 08:11
Bash ~ Compress and Extract files
# Compress
tar -cvf folder.tar folder/
gzip folder.tar
# Extract
tar -xvf folder.tar
gzip -d folder.tar.gz
@Guibzs
Guibzs / .htaccess
Last active March 26, 2023 15:17
Symfony 4 ~ .htaccess
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 302 ^/$ /index.php/
@Guibzs
Guibzs / rgar.php
Last active December 3, 2017 09:13
PHP ~ Returns a value within an array
## Function
function rgar( $array, $name )
{
if ( isset($array[$name]) )
{
return $array[$name];
}
return '';
}