Skip to content

Instantly share code, notes, and snippets.

View balos1's full-sized avatar

Cody Balos balos1

View GitHub Profile
@balos1
balos1 / De-SKU-Woo
Created November 19, 2014 05:20
De-SKU Woocommerce
<?php
/**
* Plugin Name: De-SKU-Woo
* Plugin URI: https://github.com/cojomojo/De-SKU-Woo
* Description: Remove the SKU from Woocommerce products.
* Version: 0.1
* Author: Cody Balos
* Author URI: https://github.com/cojomojo
* License: MIT
*
@balos1
balos1 / Geofield_Customizing.md
Last active February 29, 2016 14:44
Drupal Geofield Module Customizing

Geofield Customizer Module

This is an exmaple of custom Drupal module that modifies portions of the [Geofield module][1].

Current Features

  1. Alter [Geofield][1] exposed filter
    • Change distance textfield to select box
  • Default unit to miles and hide the unit selector
@balos1
balos1 / automatic_timestamped_builds.js
Last active August 29, 2015 14:26
Apache Cordova hook to automatically timestamp builds for iOS.
#!/usr/bin/env node
// Don't forget to install xml2js using npm
// `$ npm install xml2js`
var fs = require('fs');
var xml2js = require('xml2js');
module.exports = function(context) {
var timestamp = (function() {
@balos1
balos1 / install.sh
Last active January 12, 2017 07:08 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
@balos1
balos1 / create-cert.sh
Last active December 27, 2015 08:37
A bash script to create cer files quickly.
#!/bin/bash
if [ -z "$1"]
then
echo "./create.cert <name>"
echo "please provide name argument"
exit 1
else
name=$1
fi
@balos1
balos1 / docker-rmall
Last active January 12, 2016 07:07
A bash function to remove all docker containers safely.
#docker remove all containers
function docker-rmall() {
printf "The operation will remove all of the following containers: \n"
printf '%s \n' $(docker ps -a -q)
printf '%s ' 'Continue? [Y/n]: '
read response
# if yes then proceed
if [[ $response =~ ^[Yy]$ ]]
then
@balos1
balos1 / docker-stopall
Created January 12, 2016 07:07
Bash function to stop all docker containers
#docker stop all containers
function docker-stopall() { docker stop $(docker ps -a -q) }
@balos1
balos1 / docker-mongodump
Last active February 9, 2021 22:41
Dumps a mongodb database from a docker data container / restores a mongodb database dump to a docker data container.
#!/bin/bash
# Run like so:
# docker-mongodump <mongo container name> <path to backups>
MONGO_CONTAINER=$1
BACKUPS_PATH=$2
DAY=`/bin/date +%Y%m%d`
PAST_DAY=`/bin/date -d '3 days ago' +%Y%m%d`
@balos1
balos1 / create-x509-cert.sh
Created January 12, 2017 06:49
Useful for creating certificates for Microsoft Azure subscriptions management and many other things.
#!/bin/bash
if [ -z "$1"]
then
echo "./create.cert <name>"
echo "please provide name argument"
exit 1
else
name=$1
fi
@balos1
balos1 / wp-backup.sh
Created January 12, 2017 06:51
Script to backup MySQL database. Can be used with cron for automatic backups.
#!/bin/sh
DAY=`/bin/date +%Y%m%d`
PAST_DAY=`/bin/date -d '5 days ago' +%Y%m%d`
mysqldump DATABASE -u root -pPASSWORD > /path/to/it/DATABASE.$DAY.sql
rm -f /path/to/it/DATABASE.$PAST_DAY.sql