Skip to content

Instantly share code, notes, and snippets.

View MPJHorner's full-sized avatar
👨‍💻
Focusing

Matt Horner MPJHorner

👨‍💻
Focusing
View GitHub Profile
@MPJHorner
MPJHorner / clean-docker-for-mac.sh
Created July 18, 2017 17:10 — forked from MrTrustor/clean-docker-for-mac.sh
This script cleans the Docker.qcow2 file that takes a lot of disk space with Docker For Mac. You can specify some Docker images that you would like to keep.
#!/bin/bash
# Copyright 2017 Théo Chamley
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
# to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or
@MPJHorner
MPJHorner / lumen-resource-route.php
Created April 13, 2017 15:06 — forked from sohelamin/lumen-resource-route.php
Lumen Resource Routing
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
@MPJHorner
MPJHorner / Ubuntu16SwapFile
Created September 5, 2016 17:10
Create Swap File on Ubuntu 16.04
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
sudo swapon --show
@MPJHorner
MPJHorner / Docker.qcow2.reduce.sh
Created August 21, 2016 10:15
Reduce / Clean Up Docker.qcow2 File
#Ensure to exit docker from taskbar first.
cd ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux /Applications/Docker.app/Contents/MacOS/qemu-img convert -O qcow2 Docker.qcow2 Docker2.qcow2 mv Docker2.qcow2 Docker.qcow2
The API is at https://www.ipify.org/
The API endpoint is https://api.ipify.org?format=json
function httpGetAsync(theUrl, callback)
{
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
callback(xmlHttp.responseText);
docker rm $(docker ps -qa --no-trunc --filter "status=exited")
Or to force...
docker rm -f $(docker ps -qa --no-trunc --filter "status=exited")
#In this example 'phpfpm-demo' is the name of the image, you need to run this as a 'sh' script in the directory where the Dockerfile is located.
docker ps -a | awk '{ print $1,$2 }' | grep phpfpm-demo | awk '{print $1 }' | xargs -I {} docker rm {}
docker rmi phpfpm-demo
docker build -t phpfpm-demo .
docker run -p 9000:9000 phpfpm-demo
@MPJHorner
MPJHorner / FindCompanyContactsAddresses.sql
Created May 23, 2016 11:35
Show Company Contacts & Addresses Report - Khaos Control (Keystone Software)
SELECT
company.company_id,
address.address_id,
contact.contact_id,
company.company_code,
company.company_name,
address.address1,
address.address2,
address.locality,
address.town,
@MPJHorner
MPJHorner / FindPricelistDuplicates.sql
Created May 20, 2016 09:54
Find Pricelist Duplicates Report - Khaos Control (Keystone Software)
SELECT
sd.compclass_id as 'Pricelist ID',
cc.short_desc as 'Pricelist',
UPPER(st.stock_code) as 'SKU'
FROM struc_discounts AS sd
LEFT JOIN stock as st
ON sd.stock_id = st.stock_id
LEFT JOIN company_class as cc
Checkout
`git checkout --orphan latest_branch`
Add all the files
`git add -A`
Commit the changes
`git commit -am "commit message"`
Delete the branch