Skip to content

Instantly share code, notes, and snippets.

View n8kowald's full-sized avatar

Nathan n8kowald

  • Australia
  • 17:43 (UTC +09:30)
View GitHub Profile
@dannygsmith
dannygsmith / valet-plus-destroy
Last active July 18, 2023 09:07
Remove valet-plus - reboot required
#!/usr/bin/env bash
#styles
VP_NONE='\033[00m'
VP_RED='\033[01;31m'
VP_GREEN='\033[01;32m'
VP_YELLOW='\033[01;33m'
VP_PURPLE='\033[01;35m'
VP_CYAN='\033[01;36m'
VP_WHITE='\033[01;37m'
# =========================================
# Makers! Implement your own actions here.
# =========================================
class playRadio(object):
def __init__(self, say, keyword):
self.say = say
self.keyword = keyword
@davemac
davemac / pushstage
Last active November 15, 2017 05:29
wp-cli alias to push a local WP database to a staging site
# wp-cli alias to push a local WP database to a staging site
pushstage() {
START=$(date +%s)
# make a backup of the current local database
# get current directory name, used for database and URL
current=${PWD##*/}
wp db export $current.sql
# rsync the local database to staging site
rsync $current.sql $current-s:~/
# get the staging site URL for search replace
@mr-pj
mr-pj / dashbutton.py
Last active January 3, 2018 12:34
if dhcp request matches a given mac, an action will be taken. Requires pydhcplib
from pydhcplib.dhcp_network import *
def do_something():
print("button has been pressed")
netopt = {'client_listen_port':"68", 'server_listen_port':"67", 'listen_address':"0.0.0.0"}
class Server(DhcpServer):
def __init__(self, options, dashbuttons):
@davemac
davemac / pullprod
Last active July 10, 2021 03:42
bash alias using WP-CLI to pull a remote WP database into a local site
# pull a production WP database to an existing local site
# uses current directory as theme path and ssh alias
pullprod() {
START=$(date +%s)
# get current directory name, used for database and URL
# TODO: use echo get_template_directory() and get characters from right to first /
current=${PWD##*/}
cd ~/Sites/$current
# make a backup of the current local database
wp db export _db.sql
@Timothee
Timothee / _command_runner.sh
Last active September 29, 2022 00:50
This function lets you easily create series of commands into a single call # It will print each successive command, run it and, as long as it returned # with code 0, continue to the next step. # If any step fails, it will stop and let you pick it back up after you fix the # issues.
#!/usr/bin/env bash
# This function lets you easily create series of commands into a single call
# It will print each successive command, run it and, as long as it returned
# with code 0, continue to the next step.
# If any step fails, it will stop and let you pick it back up after you fix the
# issues.
#
# Example of script using this function:
# !/usr/bin/env bash
@LeCoupa
LeCoupa / bash-cheatsheet.sh
Last active May 5, 2024 00:12
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@fmtarif
fmtarif / gist:11244153
Last active December 1, 2019 18:10
#mysql - MySQL common fields/columns type and size
# http://stackoverflow.com/questions/354763/common-mysql-fields-and-their-appropriate-data-types
INT(11) for anything that is either an ID or references another ID
DATETIME for time stamps
VARCHAR(255) for anything guaranteed to be under 255 characters (page titles, names, etc)
TEXT for pretty much everything else.
VARCHAR(255) for emails
TIMESTAMP for dates, tracking creation or changes
DECIMAL(3,2) (unsigned) for 5-star rating value
@jmathai
jmathai / phpunit-reinstall.sh
Created June 14, 2012 04:15
Uninstall and reinstall phpunit
pear list -c phpunit | grep stable | awk '{print "phpunit/"$1}' | xargs pear uninstall ; pear install phpunit/phpunit
@cowboy
cowboy / HEY-YOU.md
Last active April 9, 2024 15:54
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.