Skip to content

Instantly share code, notes, and snippets.

View skyler's full-sized avatar

Skyler Slade skyler

  • SharpSpring Inc.
  • Gainesville, FL
View GitHub Profile
def find_chords(chords, music):
"""Search for chords within music (O(n) time).
:param list chords: chords to look for, in order
:param list music: music to search within
"""
if len(music) < len(chords):
return 0
my_chord_i = -1
occurrences = 0
for my_chord in music:
@skyler
skyler / tasks.yml
Created October 16, 2015 14:48
Python tasks
---
- name: yum packages for building python
yum: name={{ item }} state=latest
with_items:
- zlib-devel
- bzip2-devel
- openssl-devel
- xz-libs
- name: create work directories
{"artists":
[{"artist_name": "Ryan Adams",
"artist_id": 111,
"img": "ryan_adams2.jpeg"
},
{"artist_name": "Archers of Loaf",
"artist_id": 222,
"img": "archers_of_loaf.jpg"
},
{"artist_name": "Neko Case",
- name: create users
user: name={{ item.name }} state=present
uid={{ item.uid }}
system={{ item.get('is_system', 'no') }}
groups={{ ','.join(supplement_groups.get(item.name)) }} append=yes
with_items:
users
when: item.name in enabled_users
tags:
- users
@skyler
skyler / zapier_shopify.json
Created May 27, 2014 15:10
Shopify order fields for Zapier
{
"count_today": 0,
"children_ids": [
1242602
],
"code": "eacqr",
"date": "2014-05-27T10:01:17",
"lastchanged": "2014-05-27T10:09:20",
"title": null,
"root_id": null,
#!/bin/bash
# modified from https://gist.github.com/826961
VENV=$1
PROGNAME=$0
if [ -z $VENV ]; then
echo "usage: $PROGNAME [virtualenv_path] CMDS"
exit 1
fi
. ${VENV}/bin/activate
shift 1
#!/bin/bash
# Send an email when a pattern is matched in a log file.
# Example usage:
# /usr/local/bin/logmonitor.sh /var/log/nginx/error.log '[crit|error]' skyler@coefficientinc.com
PROGNAME=$0
function usage {
echo "usage: $PROGNAME logfile pattern recipients lines"
# Emperor uWSGI script
description "uWSGI Emperor"
start on runlevel [2345]
stop on runlevel [06]
exec /usr/local/bin/uwsgi --uid uwsgi --gid nginx --emperor /etc/uwsgi/sites --vassals-include /etc/uwsgi/default.ini --vacuum --logto /var/log/uwsgi.log --die-on-term
@skyler
skyler / wave.py
Last active August 29, 2015 13:56
from sqlalchemy import Column, Integer, Enum
from sqlalchemy.dialects.postgresql import TEXT
from sqlalchemy import MetaData, create_engine
from sqlalchemy.orm import sessionmaker, scoped_session
from sqlalchemy.ext.declarative import declarative_base
info = 'postgresql+psycopg2://panel_app@localhost:5432/panel_db'
#!/usr/bin/env bash
# save this file to $repo_dir/.git/hooks/post-checkout
# make it executable and symlink it to $repo_dir/.git/hooks/post-merge
# Delete .pyc files and empty directories from root of project
cd ./$(git rev-parse --show-cdup)
find . -type f -name "*.pyc" \
! -path "./git/*" \