Skip to content

Instantly share code, notes, and snippets.

View EricSeastrand's full-sized avatar

Eric Seastrand EricSeastrand

View GitHub Profile
@EricSeastrand
EricSeastrand / gist:b21b2e045756f719a31b951256234dec
Last active December 11, 2023 23:48
Making a Debian router

Set WAN DHCP client Set LAN static IP and subnet

cat /etc/network/interfaces 
source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
@EricSeastrand
EricSeastrand / pushFileToStorage.ts
Last active January 2, 2023 18:52 — forked from mrgarymartin/pushFileToStorage.ts
Angular Fire Upload tasks
pushFileToStorage(fileUpload: FileUpload) { // Pass in a callback as argument
const filePath = `${this.basePath}/${fileUpload.file.name}`;
const storageRef = ref(this.storage, filePath);
const uploadTask = uploadBytesResumable(storageRef, fileUpload.file);
uploadTask.on('state_changed',
(snapshot) => {
// Observe state change events such as progress, pause, and resume
// Get task progress, including the number of bytes uploaded and the total number of bytes to be uploaded
{% capture iframe_content %}
<body onload="resizeIframe()">
{{ bit_widget_html }}
</body>
{% endcapture %}
<script>
/*
@EricSeastrand
EricSeastrand / computer-control.user.js
Last active November 7, 2022 18:04
Browser side of my alexa skill
// ==UserScript==
// @name Computer Control Alexa Skill
// @namespace http://ericseastrand.com/
// @version 0.6
// @description Connects to a websocket server to listen for instructions like pausing media, searching youtube, etc..
// @author Eric Seastrand
// @match https://www.youtube.com/*
// @grant none
//@downloadURL https://gist.githubusercontent.com/willcodeforfood/c2320e6673e9137a581b66314807da46/raw/computer-control.user.js
// ==/UserScript==
@EricSeastrand
EricSeastrand / tsm_to_csv.py
Last active September 1, 2021 23:59
Converts the TradeSkillMaster data that the addon downloads into a CSV file you can upload into a Google Sheet.
import re # Regex ... sadly...
import os
# Update your WoW path here..
tsm_file = "E:/World of Warcraft/_retail_/Interface/AddOns/TradeSkillMaster_AppHelper/AppData.lua"
desktop_path = os.path.expandvars('%USERPROFILE%/Desktop/')
csv_destination = desktop_path + '/tsm_data.csv'
@EricSeastrand
EricSeastrand / magento-disable-extensions-by-glob.sh
Created April 8, 2019 13:33
Sed command to automagically disable a bunch of Magento 1 modules
sed -i'' -e's/active>true/active>false/' app/etc/modules/Mirasvit_*.xml
@EricSeastrand
EricSeastrand / shopify-twine-embed.liquid
Last active March 13, 2019 19:35
This Shopify "section" will allow you to add a Twine social feed to any sectioned page by entering the app ID.
{% assign urlParam_app = section.settings.appName | url_encode %}
{% assign urlParam_showNav = section.settings.includeNavBar | url_encode %}
{% case section.settings.loadingBehavior %}
{% when 'automatic' %}
{% assign urlParam_showLoadMore = 'no' %}
{% assign urlParam_autoload = 'yes' %}
{% when 'none' %}
{% assign urlParam_showLoadMore = 'no' %}
{% assign urlParam_autoload = 'no' %}
@EricSeastrand
EricSeastrand / magento1_find_category_scope_overrides.sql
Last active March 1, 2019 15:54
Finds all the overridden values in storeview scopes for Magento 1 categories
-- Find overridden values
SELECT a.attribute_code, overrides.* FROM (
SELECT 'datetime', entity_id, store_id, attribute_id, `value` FROM catalog_category_entity_datetime WHERE store_id!=0 UNION ALL
SELECT 'decimal', entity_id, store_id, attribute_id, `value` FROM catalog_category_entity_decimal WHERE store_id!=0 UNION ALL
SELECT 'int', entity_id, store_id, attribute_id, `value` FROM catalog_category_entity_int WHERE store_id!=0 UNION ALL
SELECT 'text', entity_id, store_id, attribute_id, `value` FROM catalog_category_entity_text WHERE store_id!=0 UNION ALL
SELECT 'varchar', entity_id, store_id, attribute_id, `value` FROM catalog_category_entity_varchar WHERE store_id!=0
) AS overrides
LEFT JOIN eav_attribute a ON overrides.attribute_id=a.attribute_id
@EricSeastrand
EricSeastrand / disable_old_cartrules.sql
Created August 31, 2018 18:20
Magento 1: SQL query to disable old shopping cart price rules
UPDATE salesrule SET is_active=0 WHERE to_date<NOW() AND is_active=1;
@EricSeastrand
EricSeastrand / pma_install.sh
Last active March 31, 2020 20:15
Install PHPMyAdmin on an AWS Elastic Beanstalk EC2 instance
## To install, log into the server, download this file, and run as webapp user like:
# sudo -u webapp bash pma_install.sh
ALLOWED_IP='' # Put your public IP here... See whatismyip.com
PMA_VERSION=4.9.5
PMA_FILE="phpMyAdmin-$PMA_VERSION-english"
INSTALL_IN_DIR='pma'
cd /var/www/html