Skip to content

Instantly share code, notes, and snippets.

View gabtio's full-sized avatar
🏠
Working from home

Gabriel gabtio

🏠
Working from home
View GitHub Profile
@pirate
pirate / strip_bad_filename_characters.sh
Last active January 22, 2025 00:49
Bash script to remove accents and special characters from filenames recursively.
#!/usr/bin/env bash
# Recursively remove all special characters from filenames by renaming them to their ASCII normalized forms.
#
# By default it does a dry run, to actually move the files uncomment the `mv -vi ...` line.
#
# This is useful for cleaning up network shares that will be shared via SMB/NFS between Unix/macOS/Windows
# where non-ASCII filenames can sometimes cause "file does not exist" errors when trying to access the files.
#
# This script removes leading/trailing whitespace in filenames and replaces accents and non-english
# characters with their ASCII equivalent, if no ASCII equivalent exists, it removes the character e.g.:
@mwender
mwender / resize-images.sh
Created December 9, 2015 13:56
Resize images of a specified size and file type.
# Credit: http://unix.stackexchange.com/questions/38943/use-mogrify-to-resize-large-files-while-ignoring-small-ones
identify -format '%w %h %i\n' ./*.jpg |
awk '$1 > 1200 || $2 > 1200 {sub(/^[^ ]* [^ ]* /, ""); print}' |
tr '\n' '\0' |
xargs -0 mogrify -quality 55 -resize '1200x1200'
@gabtio
gabtio / wp.sh
Created November 17, 2015 03:22 — forked from phlbnks/wp.sh
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Do you need to setup new MySQL database? (y/n)"
read -e setupmysql
if [ "$setupmysql" == y ] ; then
echo "MySQL Admin User: "
read -e mysqluser
@zenorocha
zenorocha / entry.js
Last active July 20, 2018 06:56
Bundling Clipboard.js distribution with Webpack
var Clipboard = require('clipboard');
@mwender
mwender / htaccess-http-to-https
Created August 6, 2015 18:55
Redirect http to https
# http to https
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
@mwender
mwender / htaccess-alias-redirect
Created June 17, 2015 14:10
Redirect all domain aliases to one with these .htaccess rules.
RewriteEngine On
# If the hostname is NOT www.domain.com
RewriteCond %{HTTP_HOST} !^www\.domain\.com$
# 301 redirect to the same resource on www.domain.com
RewriteRule (.*) http://www.domain.com/$1 [L,R=301]
@jonathantneal
jonathantneal / README.md
Last active March 24, 2025 17:47
Local SSL websites on macOS Sierra

Local SSL websites on macOS Sierra

These instructions will guide you through the process of setting up local, trusted websites on your own computer.

These instructions are intended to be used on macOS Sierra, but they have been known to work in El Capitan, Yosemite, Mavericks, and Mountain Lion.

NOTE: You may substitute the edit command for nano, vim, or whatever the editor of your choice is. Personally, I forward the edit command to Sublime Text:

alias edit="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
@mandiwise
mandiwise / Dynamically Populate Gravity Forms Text Field
Last active May 20, 2017 00:33
Using gform_field_value_{param}
function my_city_population_function( $value ){
return 'Vancouver';
}
add_filter( 'gform_field_value_my_city', 'my_city_population_function' );
@hilja
hilja / create-mysql-db.sh
Last active August 17, 2020 06:21
Shell script to create MySQL database and user
#!/bin/bash
# Functions
ok() { echo -e '\e[32m'$1'\e[m'; } # Green
EXPECTED_ARGS=3
E_BADARGS=65
MYSQL=`which mysql`
Q1="CREATE DATABASE IF NOT EXISTS $1;"