Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View ninapavlich's full-sized avatar

Nina Pavlich ninapavlich

View GitHub Profile
@ninapavlich
ninapavlich / urls.py
Created July 29, 2016 17:47
Optimized proxy view for Django
from django.conf import settings
from django.conf.urls import patterns, url, include
from django.conf.urls import patterns
from django.views.decorators.csrf import csrf_exempt
from .views cached_api_proxy_view
urlpatterns = patterns('')
urlpatterns += patterns('',
@ninapavlich
ninapavlich / convio_api.py
Last active August 24, 2016 20:25
Convio CRM API Integration
import requests
import xml.etree.ElementTree
"""
Integrate with the Convio / Blackbaud / Luminate CRM API
"""
def add_crm_user(first_name, last_name, email_address, email_opt_in, city, state, country):
API_KEY = "" #See Setup -> Site Options -> Open API Configuration
API_USERNAME = ""
@ninapavlich
ninapavlich / custom_view.html
Last active October 31, 2016 22:12
Basic nshell BaseView implementation
<section class="custom-view">
<header>
<h1>{{object.model.title}}</h1>
<h3>{{object.model.subtitle}}</h3>
</header>
<main>
<nav>
<ul>
{% for items in object.model.items %}
<li>
@ninapavlich
ninapavlich / scripts.js
Last active November 14, 2016 19:35
Simple nshell implementation
/* ========================================================================
======= Custom Data Object ================================================
======================================================================== */
var CustomAppData = function(test) {
// Call the parent constructor
BaseModel.call(this);
this.items = [];
}
@ninapavlich
ninapavlich / kiosk.js
Created November 14, 2016 19:36
Minimal nshell implementation
var Kiosk = function(options, element) {
var callbacks = {
'data_ready_handler':handle_data_ready,
'kiosk_config_data_change_handler':handle_kiosk_config_data_change,
'kiosk_data_change_handler':handle_kiosk_data_change
}
kiosk_connector = new SimpleKioskConnector(options, callbacks)
this.states = kiosk_connector.states;
this.model = kiosk_connector.model;
@ninapavlich
ninapavlich / sync.py
Last active November 22, 2016 22:51
Sync Script for frontend repo for API project
#!/usr/bin/python
import argparse
import datetime
import io
import json
import os
import sys
import urllib
import urllib2
@ninapavlich
ninapavlich / warm_cache_with_sitemap.py
Created January 5, 2017 00:11
Django management command for loading sitemap URLs, then requesting those URLs to warm the cache.
import lxml.etree
import requests
import datetime
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.contrib.sites.models import Site
class Command(BaseCommand):
@ninapavlich
ninapavlich / example_cors.xml
Created April 3, 2017 17:49
AWS S3 CORS Example
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>Authorization</AllowedHeader>
</CORSRule>
<CORSRule>
<AllowedOrigin>http://www.domain.com</AllowedOrigin>
@ninapavlich
ninapavlich / heartbeat.sh
Last active January 24, 2018 20:16
Bash script for sending a heartbeat record to a password-protected elasticsearch endpoint
#!/bin/sh
# Inputs:
# $1 = cluster
# $2 = node
# $3 = service
# $4 = tags
# $5 = uuid
# $6 = heartbeat_frequency_seconds
@ninapavlich
ninapavlich / test.sh
Last active January 24, 2018 20:23
Bash script for sending a test result record to a password-protected elasticsearch endpoint
#!/bin/sh
# Example Usage:
# test.sh 'cluster-id' 'node-id' 'my-fancy-app' 'tag-a,tag-b' 'cluster-id-node-id-my-fancy-app-unit-test-a' 'false' 'Unit Test A is failing because of X'
# test.sh 'cluster-id' 'node-id' 'my-fancy-app' 'tag-a,tag-b' 'cluster-id-node-id-my-fancy-app-unit-test-a' 'true' 'Unit Test A is passing'
# Example Usage - same service but different UUID tests:
# test.sh 'cluster-id' 'node-id' 'nginx' 'tag-a,tag-b' 'cluster-id-node-id-nginx-https-test' 'false' 'HTTPS not working on NGINX'
# test.sh 'cluster-id' 'node-id' 'nginx' 'tag-a,tag-b' 'cluster-id-node-id-nginx-port-test' 'false' 'NGINX is not running on port 80'
# test.sh 'cluster-id' 'node-id' 'nginx' 'tag-a,tag-b' 'cluster-id-node-id-nginx-memory' 'false' 'NGINX is using too much memory'