Skip to content

Instantly share code, notes, and snippets.

ameerkat /
Last active November 30, 2023 17:08
This is a simple python script that renders a Shopify theme app block to an HTML file. This can be useful for testing locally or just automated testing in general if you inject your test scripts to the page.
# Shopify App Block Loader
# This script renders block liquid files to HTML, allowing you to load them
# up and view them locally in isolation. This allows you to load them up for
# testing and to see how they operate. For example we have a complex javascript
# that runs and we need to see how it interacts with a complete page. This is
# a rough approximation of what is necessary for shopify. Does not include out
# of block scope elements but does include the wrapping block div. Note this
# does not render an entire product page. It only renders the block itself.
from scrapingbee import ScrapingBeeClient
import time
import logging
import json
class ScrappingBeeClientWrapper:
def __init__(self, client, client_config):
self.client = client
ameerkat / worldnews_fastai_classifier.ipynb
Last active April 10, 2021 17:16 example notebook for training a classifier on reddit
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Adapted from
import requests
import json
import re
import time
import os
SUBREDDIT = "movies"
ameerkat /
Created March 10, 2018 02:44
Calculate the object by object mIOU for the 2018 Data Science Bowl
import os
import settings
from tqdm import tqdm
from import imread
import numpy as np
import metrics
from keras.models import Model, load_model
from skimage.morphology import label
from skimage.transform import resize
ameerkat / app.config
Created April 7, 2017 07:28
Simple log4net format for console logging
<?xml version="1.0" encoding="utf-8" ?>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
ameerkat / MD5.cs
Created October 29, 2016 08:35
MD5 Implementation in C# based on Wikipedia psuedocode
using System;
using System.Linq;
namespace MD5
/// <summary>
/// RFC for MD5
/// Based on the pseudo code from Wikipedia:
/// </summary>
public class MD5
def missing_number(s_final):
for starting_length in range(1, (len(s_final)/2) + 1):
s = s_final[:] # copy
skipped = -1
starting_number = int(s[:starting_length])
plus_one = starting_number + 1 # the two valid options
plus_two = starting_number + 2
s = s[starting_length:]
round_passed = True
while s and round_passed:
ameerkat / SendScreencap
Created March 16, 2015 05:31
Send yourself a text and screenshot url. Useful for monitoring a long pending build/deploy operation.
import tempfile, uuid, pyscreenshot
from import TwilioRestClient
from import BlobService
# Your Account Sid and Auth Token from
twilio_account_sid = ""
twilio_auth_token = ""
client = TwilioRestClient(twilio_account_sid, twilio_auth_token)
# Screencap
ameerkat /
Created April 17, 2012 00:42
2012 Code Jam Qualifier C
def rotate(n, i):
j = 0
s = str(n)
while(j < i):
s = s[-1] + s[:-1]
j += 1
return int(s)
def rn(n, m):
count = 0