Skip to content

Instantly share code, notes, and snippets.

View electricjesus's full-sized avatar
🐅

Seth Malaki electricjesus

🐅
View GitHub Profile
@electricjesus
electricjesus / $README.md
Last active November 9, 2023 11:27
Calico Application Layer Policy via Istio Helm Install

Calico Application Layer Policy via Helm

  1. follow install steps here, EXCEPT the Install Istio part.

  2. install istio-base via helm

    • kubectl create ns istio-system
    • helm install istio-base istio/base -n istio-system --wait

    and then choose one of the below options (marked with OPTION)

/* Functional Programming 101
1.) Create a function 'last' that has the following use cases:
- last("abc") // --> outputs "c"
- last(1,2,3,"D") // --> outputs "D"
- last([1,2,3,4]) // --> outputs 4
@electricjesus
electricjesus / test.php
Created December 17, 2014 06:11
Script to test for server uptime [Magento]
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
header("Content-type: application/json");
require_once "app/Mage.php";
Mage::app($_SERVER['MAGE_RUN_CODE'], $_SERVER['MAGE_RUN_TYPE']);
$resource = Mage::getSingleton('core/resource');
// Level 1 mission
// The code does not execute properly. Try to figure out why.
function multiply(a, b){
a * b
}
// Level 2 mission
//2. Correct this code, so that the greet function returns the expected value.
@electricjesus
electricjesus / cc-verification.js
Created August 13, 2014 09:17
getCreditCardType
// automatic creditcard detection @Seth Malaki `Electric Jesus` (c) 2012
// returns credit type on success. returns null if either unsupported or fails checksum validation (Luhn algorithm).
function getCreditCardType(accountNumber, doVerify)
{
var typeKey = null;
// inspect account number, no dashes
var creditCardInspectors = {
VI : /^4\d{3}-?\d{4}-?\d{4}-?\d{4}$/, // Visa
MC : /^5[1-5][0-9]{14}$/, // Mastercard
@electricjesus
electricjesus / nginx.conf
Created May 8, 2014 06:09
NGINX Meteor with Websockets
# we're in the http context here
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# the Meteor / Node.js app server
server {
server_name yourdomain.com;
@electricjesus
electricjesus / Using Nodemon with Meteor.md
Last active December 30, 2015 00:09
Using Nodemon with Meteor for Rails-Guard-Style testing workflow

Using nodemon with meteor

Introduction

Earlier today, I was trying to find a quick rails-guard-esque workflow for Meteor with the Laika testing framework. Looking back at Rails' own solution, guard, I thought I would need a way to do the following:

  • Look for file changes in a tree / list of files & file trees
  • Define ignores for efficiency
@electricjesus
electricjesus / magecleanup.sql
Created November 1, 2013 15:42
mage cleanup - The two queries you need when you need to clean out categories and products. I haven't tested this with active orders, yet. I usually use this before re-importing via Magmi. I use this for my own DEVELOPMENT purposes. SHORT RAW: http://git.io/4KbqhA
## PLEASE use this for DEVELOPMENT only. Don't blame me if you're a dumbass.
DELETE FROM `catalog_product_entity`;
DELETE FROM `catalog_category_entity` WHERE `entity_id` NOT IN (1,2);
@electricjesus
electricjesus / any number
Last active December 22, 2015 21:19
takes a start year and end year, returns an array of years that have four different numbers. http://imgur.com/gallery/rDJjm
(function(start, max) {
results = [];
for(i = start;i <= max; i++) {
var year = String(i);
var f = "0123456789"
.split("")
.filter(function(n) {
return year.indexOf(n) != -1
});
@electricjesus
electricjesus / input.txt
Created March 28, 2013 06:48
my solution to HackerCup Beauiful strings
20
jWDjwOfloryIR(QW(I .Sowv h(iVMrWgpACa(vC.!dadFYlZ)LmOHnXQRzLFZbco;Fyn.swYxiN:wEidtrEAThwfrwpZWNVyMEBSKEthBUxcfxzzjPPShgidtRWfI:nlFMadPEzAdrFchivgrVrbaykkpr
IMNnye:LzeZKXlg!wGBx)Vp(tavJtLvnquSUeRQcG;bzTnJ; B(I)uepJwyqGwOSCPwgpCbw.LyXouVDKjYU HJO.Lkdc;VZBMaBca.Citq!kVlUfZk
mUh lsSDQuJwIZyH;gIBGYwEgknKbtuEspfR)qlOFuzh:uaAj(qLFmrdwShGjXE:(!hwFlUmWJm.eO;NMtFMBvIL!KhOP.VZkkEzPpXaRWHK(:s.UTjcXLA;Oc :uvD.VbSBZWv!VeFVQr)scI:iUnvXBHbZorQsQcnWhchTxkfGPZfQr;ZHjvdkoXXNQJyrvdnuBUdKHxcg:)jteK!WUkmgrmBCFwGp HiR HAkJNz!W.uwmu)I.BRlTojqu;KZwfJWtU!Oq.drauj cWIDHwvDzg:oG:(wafSbO(ZK(RiaQ.CVe(rQqhqC
SltSxIxJKmZoO.QM)JrEfP;)eieonGJicUJSFjWpEptJUD:cgf(uvJu!uvLsmizW!Xdz:SpXqHJyfQ()uib.wfRE;b!GGcYTAZDyJ(w(ZBhoFHyyBdaqC(HIdVUp!yY)L)MzzFe)oGsuLD!GzSmvtqWWyMAXh;fZVHVKEaRIB M: zDwNE)Ls!TTmbWWacgzHOwKB(LtLsTsJFpzjB)EumVerkChSjMpDWpO(NUXRjsoJGizdzXdQdYJCFeAZLLPpNQmVHsAKmN):gN
dcZWNczbPWCQswmO.veDGQ.ENwmkAAYMFNOB.LXsMeCDrK.YRk(wluBTTlkk:eaLTE(u;qaZWNwGXds(J!OrYhCskAPetfckT qbkTclxiO!ArM!BJImdOHjcCraYYBUMROmvkAGyuPSgmuARGkXsNzroKIl:i)YgzWE