Skip to content

Instantly share code, notes, and snippets.

View amacgregor's full-sized avatar
:shipit:
Working on Side Projects

Allan MacGregor amacgregor

:shipit:
Working on Side Projects
View GitHub Profile
@GuillaumeDievart
GuillaumeDievart / elk-magento-exception
Created January 8, 2015 18:43
logstash for magento exception
input {
file {
type => "magento-exception"
path => "/path/to/magento/www/var/log/exception.log"
codec => multiline {
pattern => "^%{TIMESTAMP_ISO8601}"
negate => true
what => previous
}
}
@madrobby
madrobby / gist:2890359
Created June 7, 2012 17:48
creditcard.prototype.js
var CreditCard = {
CARDS: {
Visa: /^4[0-9]{12}(?:[0-9]{3})?$/,
MasterCard: /^5[1-5][0-9]{14}$/,
DinersClub: /^3(?:0[0-5]|[68][0-9])[0-9]{11}$/,
Amex: /^3[47][0-9]{13}$/,
Discover: /^6(?:011|5[0-9]{2})[0-9]{12}$/
},
TEST_NUMBERS: $w('378282246310005 371449635398431 378734493671000 '+
'30569309025904 38520000023237 6011111111111117 '+
@ceckoslab
ceckoslab / dump-subset-of-magento-orders-and-customer-data.php
Created January 9, 2017 22:24
Proof of concept of script that does mysql dump of subset of Magento orders + related sales tables and customer's data of customer that did the orders. The script also attempts to import the data in local database. Currently the script gets last 1000 orders and customers data of customers that created the orders. Data anonymization is not implem…
<?php
$mysqlCommandPath = 'to be filled';
$mysqldumptCommandPath = 'to be filled';
$remoteDbUnsername = 'to be filled';
$remoteDbPassword = 'to be filled';
$remotePort = 'to be filled';
$remotHost = 'to be filled';
$remoteDb = 'to be filled';
@dm1try
dm1try / my.zsh-theme
Created January 9, 2016 03:55
custom theme for my oh-my-zsh. It displays `elixir`/`ruby` version in the prompt(dependent on current dir); requirements `rvm` for `ruby`, `kiex` for `elixir`
function elixir_version() {
if [ -f "$PWD/mix.exs" ]; then
echo "$ELIXIR_VERSION "
fi
}
function ruby_version() {
if [ -f "$PWD/Gemfile" ]; then
echo "${RUBY_VERSION#*-} "
fi
@boredzo
boredzo / colorman.zsh
Last active June 19, 2017 14:44 — forked from cocoalabs/gist:2fb7dc2199b0d4bf160364b8e557eb66
Color Terminal for bash/zsh etc..
man() {
env \
LESS_TERMCAP_md=$'\e[1;36m' \
LESS_TERMCAP_me=$'\e[0m' \
LESS_TERMCAP_se=$'\e[0m' \
LESS_TERMCAP_so=$'\e[1;40;92m' \
LESS_TERMCAP_ue=$'\e[0m' \
LESS_TERMCAP_us=$'\e[1;32m' \
man "$@"
}
@grega
grega / vbox-status-check.sh
Last active January 26, 2019 16:27
Output the total number of currently running VirtualBox VMs, along with their names. This has been written with Vagrant in mind, where VMs are named `hostname_default_xxxxxxxxx` where only the value of `hostname` is relevant/recognisable.
#!/bin/bash
machines=()
for machine in `VBoxManage list runningvms|cut -d" " -f 1`; do
machines+=("$machine")
done
if [ ${#machines[@]} -eq 1 ]; then
machinename=$(echo ${machines[@]} | cut -d'_' -f 1)
@Vinai
Vinai / bootstrap.php
Last active January 29, 2019 22:50
Simple Magento integration test PHPUnit bootstrap
<?php
/**
* Simple Magento integration test PHPUnit bootstrap
*/
chdir(__DIR__ . '/../..');
$mageFile = 'htdocs/app/Mage.php';
umask(0);
@Vinai
Vinai / magento-composer-issues.md
Last active April 15, 2020 03:09
My beef with composer and Magento
@greghgradwell
greghgradwell / 0_in_the_middle.md
Last active November 17, 2020 13:28
0. In the beginning, there was the middle

0. In the beginning, there was the middle...

You're jumping into a novel at about Chapter 6. And no, that's not because you missed the earlier chapters. I am only writing it now because it has finally become something worth recording (and hopefully reading). First, let me assure you that this is neither a theoretical exercise, nor a vague description of a "stealth" project. In short order you will be introduced to the current prototype that has already demonstrated many of the original project goals. And there will be plenty of pictures (please ignore the fact that this post has approximately 0 pictures 😬).

This project started out as somewhat of an experiment, or rather, it was a means to scratch an itch that had been bothering me for a few years:

What does it take to make an autopilot sufficiently reliable, affordable, and integratable enough to be extremely useful?

Or written as more of a challenge:

Can I create an autopilot that I could trust, afford, and would actually want t

@greghgradwell
greghgradwell / 1_hardware_vs_software.md
Last active April 9, 2021 15:36
1. Hardware vs. Software

1. Hardware vs. Software

Software is great, but at some point it has to interact with hardware or it's useless. One of the pressing questions early on was how many of the hardware interfaces could be written in Elixir. For example, the first peripheral I wanted to test out was an IMU (inertial measurement unit). If I were working with Arduino, I would have a library already available, ready to plug and play.

Should I connect the IMU to an Arduino board, and then interface with the Arduino board using a serial protocol of my choice? Or does the extra hardware outweigh the benefits of ready-to-use software?

Since I was still very new to Elixir, I thought it would be interesting to replicate one of my previous projects that had utilized Arduino, in this case a 2-axis camera gimbal. Do I have pictures of the original? No. Did I take pictures of the Elixir version before I took it apart? Also no. So we'll have to use our imaginations. (Don't worry, I hear your boos and I agree)All I can offer i