Skip to content

Instantly share code, notes, and snippets.

View bkozora's full-sized avatar

Bobby Kozora bkozora

  • Philly
View GitHub Profile
@bkozora
bkozora / magento-database-config.php
Created April 5, 2016 20:35
Retrieve Magento Database Configuration
<?php
require_once ("../app/Mage.php");
$app = Mage::app('default');
$config = Mage::getConfig()->getResourceConnectionConfig("default_setup");
$dbinfo = array(
"host" => $config->host,
"user" => $config->username,
@bkozora
bkozora / magento-orphaned-enabled-products.sql
Created April 5, 2016 15:25
Magento - Grab Orphaned Enabled Products
SELECT
*
FROM
catalog_product_entity a
LEFT JOIN
catalog_product_entity_int ei ON ei.entity_id = a.entity_id
LEFT JOIN
catalog_category_product cp ON cp.`product_id` = a.entity_id
LEFT JOIN
catalog_product_relation cpr ON cpr.child_id = a.entity_id
time wget -O /dev/null http://speedtest.wdc01.softlayer.com/downloads/test10.zip
@bkozora
bkozora / custom-font.css
Created March 24, 2016 15:23
Custom Font
@font-face {
font-family: 'optimaroman';
src: url('https://media.wheaton.com/fonts/optima-webfont.eot');
src: url('https://media.wheaton.com/fonts/optima-webfont.eot?#iefix') format('embedded-opentype'), url('https://media.wheaton.com/fonts/optima-webfont.woff2') format('woff2'), url('https://media.wheaton.com/fonts/optima-webfont.woff') format('woff'), url('https://media.wheaton.com/fonts/optima-webfont.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
@bkozora
bkozora / .bashrc
Last active April 7, 2016 13:13
Bash History Modifications
##
# Customize our history
##
# Number of commands stored in current session's history
HISTSIZE=5000
# Filesize of ~/.bash_history
HISTFILESIZE=10000
@bkozora
bkozora / lambdaAMICleanup.py
Last active October 29, 2024 02:53
AWS Lambda Function to Delete AMIs and Snapshots
# Automated AMI and Snapshot Deletion
#
# @author Bobby Kozora
#
# This script will search for all instances having a tag named "Backup" with a value of "Backup".
# As soon as we have the instances list, we loop through each instance
# and reference the AMIs of that instance. We check that the latest daily backup
# succeeded then we store every image that's reached its DeleteOn tag's date for
# deletion. We then loop through the AMIs, deregister them and remove all the
# snapshots associated with that AMI.
@bkozora
bkozora / lambdaAMIBackups.py
Last active February 13, 2025 04:27
AWS Lambda AMI Backups
# Automated AMI Backups
#
# @author Bobby Kozora
#
# This script will search for all instances having a tag with the name "backup"
# and value "Backup" on it. As soon as we have the instances list, we loop
# through each instance
# and create an AMI of it. Also, it will look for a "Retention" tag key which
# will be used as a retention policy number in days. If there is no tag with
# that name, it will use a 7 days default value for each AMI.
@bkozora
bkozora / amiBackups.py
Last active November 26, 2020 13:13
Creates AWS AMIs for multiple configured EC2 instance IDs
#!/usr/bin/python
#
# This script will create an AMI for each of the instances listed in the
# instance_ids list. It will also clean up AMIs based on the images_to_keep
# variable. The cleanup logic has no concept of time so the images are just
# deleted based on number. It is recommended to run the script daily from
# cron during off peak time and by default keep 7 days.
#
import boto, boto.ec2
@bkozora
bkozora / checkFilesForAjax.js
Last active September 12, 2017 06:39
checkFilesForAjax.js
var dir = require('node-dir');
var url = require('url');
// The starting directory to recursively search in
var path = 'C:\\Users\\kozorar\\Development\\wheaton-us\\js';
// Our regular expression to parse out URLs from the page contents
var urlRegex = /((http|https):\/\/(?!www\.wheaton\.com|wheaton.com)[\w\.\/\-=?#]+)/gi
// Our regular expression to parse out attmepts to clear the console
@bkozora
bkozora / bash-ftp-upload.sh
Created December 9, 2015 14:22
Bash - FTP Upload
#!/bin/sh
# FTP Server
HOST='server.address'
# FTP Username
USER='username'
# FTP Password
PASSWD='ftp.password'