Skip to content

Instantly share code, notes, and snippets.

View tegansnyder's full-sized avatar
💭
Stay'n cold in Minnesota

Tegan Snyder tegansnyder

💭
Stay'n cold in Minnesota
View GitHub Profile
@tegansnyder
tegansnyder / Magento 2 Programmatically Ship an Order with Tracking Details outside of Magento.md
Created March 29, 2021 04:39
Magento 2 Programmatically Ship an Order with Tracking Details outside of Magento

Create a file called abstract.php and place it in your root Magento folder:

abstract.php
<?php
use \Magento\Framework\AppInterface as AppInterface;
use \Magento\Framework\App\Http as Http;

use Magento\Framework\ObjectManager\ConfigLoaderInterface;
use Magento\Framework\App\Request\Http as RequestHttp;
@tegansnyder
tegansnyder / Preventing-Puppeteer-Detection.md
Created February 23, 2018 02:41
Preventing Puppeteer Detection

I’m looking for any tips or tricks for making chrome headless mode less detectable. Here is what I’ve done so far:

Set my args as follows:

const run = (async () => {

    const args = [
        '--no-sandbox',
        '--disable-setuid-sandbox',
        '--disable-infobars',
@tegansnyder
tegansnyder / hdfs_file_cleanup_cron.sh
Created October 17, 2017 20:34
HDFS cron to delete old files in directory
#!/bin/bash
now=$(date +%s);
days_to_keep=5
# Loop through files
hdfs dfs -ls /some_hdfs_directory | while read f; do
# Get File Date and File Name
file_date=`echo $f | awk '{print $6}'`;
file_name=`echo $f | awk '{print $8}'`;
@tegansnyder
tegansnyder / pyspark error.md
Created January 6, 2017 15:59
pyspark error

I'm recieving a strange error on a new install of Spark. I have setup a small 3 node spark cluster on top of an existing hadoop instance. The error I get is the same for any command I try to run on pyspark shell I get the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/spark/python/pyspark/rdd.py", line 1041, in count
    return self.mapPartitions(lambda i: [sum(1 for _ in i)]).sum()
  File "/opt/spark/python/pyspark/rdd.py", line 1032, in sum
    return self.mapPartitions(lambda x: [sum(x)]).fold(0, operator.add)
  File "/opt/spark/python/pyspark/rdd.py", line 906, in fold
@tegansnyder
tegansnyder / Flushing DNS cache macOSX Sierra.sh
Created December 29, 2016 15:30
Flushing DNS cache macOSX Sierra
sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder;say flushed
@tegansnyder
tegansnyder / MacOS Sierra - Custom PHP Compiled from Source with Threading and Custom ODBC Support.md
Last active December 11, 2022 21:53
MacOS Sierra - Custom PHP Compiled from Source with Threading and Custom ODBC Support

I recently got a new Macbook Pro and wanted to document how I setup my PHP environment. I like full control of how PHP is built and I usually build it from source. I do this because I often add custom extensions and modules not found in the common PHP OSX installers. If your looking for a easier method than building from source try https://php-osx.liip.ch/.

NOTE: This post assumes you are running a fresh install of MacOS Sierra 10.12.16 with System Integrity Protection disabled. If you don't know how to disable it just boot into recovery mode and open a terminal and type csrutil disable, or google search it :) This post also assumes you are using Zsh instead of Bash shell. If you are using Bash you can replace anytime you see ~/.zshrc with ~/.bashrc.

First lets get some of the prerequisites. Start by grabbing the command line tools neccessary:

xcode-select --install
@tegansnyder
tegansnyder / Details On Fixing USB-C Gigabyte Ethernet Adaptor in 2016 Macbook Pro.md
Created December 20, 2016 18:51
Late 2016 Macbook Pro - Solving an issue with USB-C Gigabyte Ethernet Adaptor

I recently recieved a new Macbook Pro. This was one of the latest 2016 models, that have the touchbar. Mine took a little longer to ship as I got it maxed out. When i arrived I went through the standard setup proceedure for a new mac. I then attempted to hook up a USB-C Ethernet Adaptor from C2G. It was suppose to work right out of the box, but it didn't work. I hooked the same device into another collegue of mines new Macbook Pro 2016 and it worked. I could see the Network panel load a device by the name of "AX88179 USB 3.0 to Gigabit Ethernet". So I went looking on the internet, thinking if I could find the driver and install it on my mac, I could get it work. I found the USB-C driver here: http://www.asix.com.tw/FrootAttach/driver/AX88179_178A_Macintosh_10.6_to_10.12_Driver_Installer_v2.8.0_20161108.zip

For those that are scratching your head trying to figure out why your USB-C Ethernet adapter is not working maybe that could help. It did for me.

@tegansnyder
tegansnyder / Using PHP ZTS (Zend Thread Safety) module and pthreads on PHP7 Webstatic Repo (Centos-RHEL).md
Last active November 20, 2020 13:06
Using PHP ZTS (Zend Thread Safety) module and pthreads on PHP7 Webstatic Repo (Centos/RHEL)

BECOM SUDO USER:

sudo -s

INSTALL WEBSTATIC REPO FOR CENTOS/RED HAT 7:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
@tegansnyder
tegansnyder / Starting Kafka.md
Last active February 8, 2017 20:16
Starting Kafka
dzdo -s
cd /usr/bin
zookeeper-server-start -daemon /etc/kafka/zookeeper.properties
kafka-server-start -daemon /etc/kafka/server.properties
schema-registry-start -daemon /etc/schema-registry/schema-registry.properties


# toping
dzdo -s