Skip to content

Instantly share code, notes, and snippets.

View mcotton's full-sized avatar

Mark Cotton mcotton

View GitHub Profile
@mcotton
mcotton / blah.py
Last active June 24, 2017 20:32
emergency add checklist to company/projects
execfile('remote.py')
co = Company.query(Company.name=="Pattern Energy").get()
add_checklist_to_company(company=co, filename="inspection-Pattern.json")
projects = Project.query(Project.company==co.key).fetch()
for p in projects:
add_checklist_to_project(project=p, filename="inspection-Pattern-GETS.json")
@mcotton
mcotton / fix_gae.sh
Created March 13, 2017 15:30
Fix GAE to use ipython with with remote shell
#!/bin/bash
# Pathes remote_api_shell.py to use IPython instead of raw python interpreter
google_path=`readlink $(which remote_api_shell.py)`
google_path=$(dirname $google_path)
echo "Google Appengin found on: $google_path"
ras_path="$google_path/google/appengine/tools/remote_api_shell.py"
@mcotton
mcotton / mtime_file_watcher.py
Last active January 2, 2017 18:55
Fix for GAE dev_server error
# https://johanndutoit.net/app-engine-too-many-files/
#google_appengine/google/appengine/tools/devappserver2/mtime_file_watcher.py:115:
#UserWarning: There are too many files in your application for changes in all of them to be monitored.
#You may have to restart the development server to see some changes to your files.
# for me the file is located:
# /Applications/Developer/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2
# add this on line 106
@mcotton
mcotton / import_project.py
Last active July 11, 2017 16:10
Ugly way to create projects from csv
import csv
with open('Titan-1.csv', 'rU') as csvfile:
filereader = csv.reader(csvfile, delimiter=',', quotechar='|')
for row in filereader:
new_p = Project(title="%s - %s" % (site.name, row[0]),
company=comp.key,
company_name=comp.name,
wind_farm=site.name,
site = site.key,
location="%s, %s" % (row[1], row[2]),
@mcotton
mcotton / gist:f78a7817f1d199f06bf8
Last active January 10, 2022 18:14
ffmpeg video from pictures
# start with DSC00013.JPG and continue sequentially
# basic version: ffmpeg -r 1 -y -start_number 13 -i DSC000%02d.JPG -r 24 out.mp4
ffmpeg -r 2 -s 1920x1080 -y -start_number 325 -i DSC00%03d.JPG -s 1920x1080 -c:v libx264 -r 24 -pix_fmt yuv420p -f MP4 ~/Desktop/out.mp4
# same thing with ImageMagick
convert -delay 50 *.png -loop 0 animate.gif
@mcotton
mcotton / main.py
Created February 4, 2016 15:52
Working with dates in arrow and gae
# reference issue for making it work on GAE
# https://github.com/crsmithdev/arrow/issues/240
import os
import pprint
from google.appengine.api import memcache
from google.appengine.api import mail
from google.appengine.api import urlfetch
from google.appengine.ext import ndb
http://launched.zerowidth.com/plists/da7dd800-a38a-0133-1b12-0a18f9fba686
@mcotton
mcotton / getMedia.py
Created January 21, 2016 20:50
Pull Media by Project key
import os
import pprint
from google.appengine.api import memcache
from google.appengine.api import mail
from google.appengine.api import urlfetch
from google.appengine.ext import ndb
from google.appengine.api import search
from core.models import *
@mcotton
mcotton / interactive.py
Created January 21, 2016 00:24
Enable company_dashboard for a user
import os
import pprint
from google.appengine.api import memcache
from google.appengine.api import mail
from google.appengine.api import urlfetch
from google.appengine.ext import ndb
from google.appengine.api import search
from core.models import *
ffmpeg -f concat -i catlist -c copy output.mp4
# catlist
file 'public/media/bumpers/intro.mp4'
file 'HUVR_Blade_1.mp4'
file 'public/media/bumpers/outro.mp4'