Skip to content

Instantly share code, notes, and snippets.

Joffrey Guibzs

Block or report user

Report or block Guibzs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Guibzs
Guibzs / views.sql
Last active Jan 25, 2019
MySQL ~ Views
View views.sql
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 Nov 12, 2018
Bash ~ Search in files
View search
@Guibzs
Guibzs / replace.sql
Last active Aug 27, 2019
MySQL ~ Replace
View replace.sql
UPDATE table
SET column = REPLACE(column, ‘search’, ‘replace’);
@Guibzs
Guibzs / hide_show
Last active Mar 4, 2019
Hide/Show files & folders on macOS
View hide_show
defaults write com.apple.finder AppleShowAllFiles YES
defaults write com.apple.finder AppleShowAllFiles NO
@Guibzs
Guibzs / connection
Last active Oct 10, 2018
SSH commands
View connection
ssh username@hostname
@Guibzs
Guibzs / permisssions
Last active Mar 6, 2019
Bash ~ Change file permissions and ownership
View permisssions
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 Aug 27, 2019
Bash ~ Compress and Extract files
View tar_gzip
# Compress
tar -cvf folder.tar folder/
gzip folder.tar
# Extract
tar -xvf folder.tar
gzip -d folder.tar.gz
@Guibzs
Guibzs / .htaccess
Last active Dec 7, 2019
Symfony 4 ~ .htaccess
View .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 Dec 3, 2017
PHP ~ Returns a value within an array
View rgar.php
## Function
function rgar( $array, $name )
{
if ( isset($array[$name]) )
{
return $array[$name];
}
return '';
}
@Guibzs
Guibzs / backup
Last active Aug 27, 2019
Shell ~ Work with mysql backups
View backup
# Making a new backup
mysqldump database_name > database_name.sql
mysqldump --databases database_one database_two > two_databases.sql
mysqldump --all-databases > all_databases.sql
# Restoring from a backup
mysql database_name < database_name.sql
mysql --one-database database_name < all_databases.sql
# Working with tables
You can’t perform that action at this time.