Skip to content

Instantly share code, notes, and snippets.

View redolivedev's full-sized avatar

Red Olive Dev redolivedev

View GitHub Profile
@redolivedev
redolivedev / Do not require password for sudo for `username`
Last active June 30, 2017 21:32
Do not require password for sudo for `username`
sudo visudo
# At the bottom of the file, add the following:
username ALL=(ALL) NOPASSWD: ALL
@redolivedev
redolivedev / remove-special-characters.sh
Created May 1, 2017 14:45
Remove special characters that don't show up on smb shares
#!/usr/bin/env bash
find "$1" -depth -print0 | while IFS= read -r -d '' file; do
d="$( dirname "$file" )"
f="$( basename "$file" )"
new=$(sed "s/[<>:;\"/\\|?*]/-/g" <<< "$f")
if [ "$f" != "$new" ]; then
if [ -e "$d/$new" ]; then
echo "Notice: \"$new\" and \"$f\" both exist in "$d":"
ls -ld "$d/$new" "$d/$f"
else
@redolivedev
redolivedev / heading-classes.scss
Created April 4, 2017 15:19
Foundation 6 Heading Classes
// Heading styles
@each $size, $headers in $header-styles {
@include breakpoint($size) {
@each $header, $header-defs in $headers {
$font-size-temp: 1rem;
.#{$header} {
@if map-has-key($header-defs, font-size) {
$font-size-temp: rem-calc(map-get($header-defs, font-size));
font-size: $font-size-temp;
@redolivedev
redolivedev / Srape site for images
Created March 27, 2017 14:48
Scrape a site's images
wget -nd -H -p -A jpg,jpeg,png,gif -e robots=off http://sitetoscrape.com/
# Will create backup file (e.g. file1.txt.bak)
sed -i.bak 's/oldword/newword/' file1.txt
@redolivedev
redolivedev / Homebrew: Remote mariadb connections
Last active April 3, 2017 15:57
Enable remote connections with mariadb on homebrew
# Open mysql launch file
vim ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
And change this line:
`--bind-address=127.0.0.1`
to:
`--bind-address=0.0.0.0`
# And finally reload MySQL
@redolivedev
redolivedev / _timelog.sh
Last active February 21, 2017 19:12
Get your time from all repos in directory for the last month and save it to a file on your desktop
#!/bin/bash
# Instructions
## Save this file to the root of where your projects are stored
## cd to the projects root directory and run chmod +x _timelog.sh
## Change Michael Bonner to your name as it's set in your git config
#
AUTHOR="Michael Bonner"
ONE_MONTH_AGO=`date -j -v-1m`
function maybe_start_session(){
if( php_sapi_name() == 'cli' ) return;
if( version_compare( phpversion(), '5.4.0', '>=' ) ) {
if( session_status() != PHP_SESSION_ACTIVE ) session_start();
} else {
if( session_id() === '' ) session_start();
}
}
@redolivedev
redolivedev / The fix for ubuntu lamp permissions
Last active January 25, 2017 20:53
The fix for ubuntu lamp permissions
# Key:
## {YOUR_USER_NAME} replace with the user you log in to the system as
## {APPLICATION_DIRECTORY} : replace with the project directory name
# Installing bindfs (just the first time)
$ sudo apt-get update
$ sudo apt-get -y install bindfs
# Creating the application mountpoint
$ mkdir -p /home/{YOUR_USER_NAME}/sites/{APPLICATION_DIRECTORY}