Skip to content

Instantly share code, notes, and snippets.

View franckweb's full-sized avatar

Franck Mercado franckweb

  • Globant
  • Cusco, Perú
View GitHub Profile
@franckweb
franckweb / bulk-image-process.sh
Last active April 25, 2020 13:39
Convert optimize resize multiple images through bash script
# USAGE
# bash bulk-image-process.sh [path/to/images]
# current exec folder is used as destination
destination_dir=$(pwd)
source_dir=$1
for photo in $source_dir/*.jpg;
do
@franckweb
franckweb / alias.sh
Last active March 19, 2020 03:57
Alias
# Prints permissions in octal format
# perms filename.jpg
# perms *
alias perms='stat -c "%a %n"'
@franckweb
franckweb / mysql-workbench-install.txt
Created February 9, 2020 21:48
Mysql Workbench for Ubuntu 16.04 installation
# MYSQL WORKBENCH installation
# download archive version for Ubuntu 16.04 from
# https://downloads.mysql.com/archives/workbench/
# running
sudo dpkg -i mysql-workbench-community-6.3.10-1ubuntu16.04-amd64.deb
# throws error
(Reading database ... 278976 files and directories currently installed.)
Preparing to unpack mysql-workbench-community-6.3.10-1ubuntu16.04-amd64.deb ...
@franckweb
franckweb / automate-virtualmin.ssh
Created October 6, 2018 15:05
Move non-Virtualmin accounts into Virtualmin transferring data and databases
# Move non-Virtualmin accounts into Virtualmin transferring data and databases
# When its done update config files
# TODO: automate the updating of common config files
# Connects to the destination server to create the Virtualmin server
#Then connects to the source to move files and databases across
set -e
# New Site Settings
@franckweb
franckweb / woocommerce-functions.php
Created June 28, 2018 20:34
Personalized woocommerce for wordpress
/*
* Personalized sorting options
*/
add_filter( 'woocommerce_get_catalog_ordering_args', 'custom_woocommerce_get_catalog_ordering_args' );
function custom_woocommerce_get_catalog_ordering_args( $args ) {
$orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
$fallback = apply_filters( 'wc_extra_sorting_options_fallback', 'title', $orderby_value );
$fallback_order = apply_filters( 'wc_extra_sorting_options_fallback_order', 'ASC', $orderby_value );
# ALBERT A fast and flexible keyboard launcher
## installation taken from
## https://software.opensuse.org//download.html?project=home%3Amanuelschneid3r&package=albert
## For xUbuntu 18.04 run the following
echo 'deb http://download.opensuse.org/repositories/home:/manuelschneid3r/xUbuntu_18.04/ /' | sudo tee /etc/apt/sources.list.d/home:manuelschneid3r.list
curl -fsSL https://download.opensuse.org/repositories/home:manuelschneid3r/xUbuntu_18.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/home_manuelschneid3r.gpg > /dev/null
sudo apt update
sudo apt install albert
@franckweb
franckweb / vim-plugins.sh
Last active April 5, 2018 18:56
Vim Plugins
# VIM PLUGINS
## Install Pathogen (vim plugins manager)
mkdir -p ~/.vim/autoload ~/.vim/bundle;
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
## Create ~/.vimrc and add these contents
" contents of minimal .vimrc
execute pathogen#infect()
syntax on
filetype plugin indent on
@franckweb
franckweb / docker-commands.sh
Last active March 21, 2023 02:32
Docker commands
## Add current logged in linux user to docker group
1. sudo usermod -aG docker ${USER}
# To apply the new group membership, log out of the server and back in, or type the following:
2. su - ${USER}
# You will be prompted to enter your user’s password to continue.
# Confirm that your user is now added to the docker group by typing:
3. groups
@franckweb
franckweb / sql-queries.sql
Last active December 14, 2017 16:42
SQL Queries
## EXPLAIN SQL function
# https://dev.mysql.com/doc/refman/5.7/en/using-explain.html
# https://www.sitepoint.com/using-explain-to-write-better-mysql-queries/
@franckweb
franckweb / helpful-scripts.sh
Last active November 20, 2018 03:20
Helpful scripts
## VIM usage
# to delete all lines in a file
:1,$d
## SUBLIME Tabs
{ "keys": "ctrl+pagedown", "command": "next_view_in_stack" },
{ "keys": "ctrl+pageup", "command": "prev_view_in_stack" },
{ "keys": ["ctrl+tab"], "command": "next_view" },