Skip to content

Instantly share code, notes, and snippets.

View jheasly's full-sized avatar

John Heasly jheasly

View GitHub Profile
@jheasly
jheasly / jquery video
Created February 15, 2012 18:23
Pulling in remote-hosted video
<script type="text/javascript">
$(document).ready(function(){
jwplayer('mediaplayer').setup({
id: 'playerID',
width: 546,
height: 313,
file: 'http://s3.amazonaws.com/headsup.orcasinc.com/video/concussion_video.mp4',
image: 'http://s3.amazonaws.com/headsup.orcasinc.com/video/concussion_video.jpg',
modes: [
{type: 'html5'},
@jheasly
jheasly / gist:1953486
Created March 1, 2012 21:54
Jython script to connect to Caché database, export stories to a Python pickle
#! /usr/bin/env /opt/local/bin/jython
# -*- coding: utf-8 -*-
from java.lang import *
from java.sql import *
def main():
import sys, datetime, cPickle, codecs
sys.path.append('/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/')
from BeautifulSoup import BeautifulSoup
@jheasly
jheasly / gist:1953501
Created March 1, 2012 21:55
Unpickle, insert into Django postgresql db.
#!/usr/bin/python
# -*- coding: utf-8 -*-
from BeautifulSoup import BeautifulSoup
import tagfile, datetime, sys, re, pickle, psycopg2
from os import environ
sys.path.append('/directory/nuther_directory')
sys.path.append('/directory/nuther_directory/project_directory')
environ['DJANGO_SETTINGS_MODULE'] = 'project_directory.settings'
from turin.models import Story, Image, Mugline
@jheasly
jheasly / topadsFeed_fragment.py
Created June 12, 2012 20:14
A section of topadsFeed.py
def removeNonASCII(file):
""" remove non-ASCII chars from file, after making a bakup first
"""
fileBak = "%s.bak" % (file)
err = os.system("cp -p %s %s" % (file, fileBak))
if err:
return
fout = open(fileBak, 'w')
for line in fileinput.input(file):
fout.write(re.sub(r'[\x80-\xff]', '', line))
@jheasly
jheasly / report-on-slotted-stories.sql
Last active October 9, 2015 06:58
Report on slotted stories
/*
Tweak of unified namespace query for use in plain ol' namespace. Based on query by Aaron Kuehn.
May 9, 2013: Added dt_cms_schema.Mapping.version to SELECT.
*/
select
dt_cms_schema.publication.name "Publication Name",
dt_cms_schema."section".name "Section Name",
dt_cms_schema.slotreference.name "Slot Name",
dt_cms_schema.Mapping.version "Version",
@jheasly
jheasly / goodies.md
Created November 20, 2012 21:26 — forked from mhulse/How to delete a story from Lightning, for keeps.md
Caché DTI ContentPublisher v7.7.3 and above: dt_cms_schema.SEOStoryLookup SQL goodies!

Add an entry to the SEOStoryLookup table:

INSERT INTO dt_cms_schema.SEOStoryLookup (cmsStoryId, created, internalStoryURL, seoURL, serverName, urlType, version)
VALUES (123456, getDate(),'/csp/cms/sites/publication/section/index.csp', '/some/funky/url.html', 'localhost', 0, 61)

Where:

  • created = When entry it was made. Used mainly for troubleshooting/cleanup (avoid searching on this).
@jheasly
jheasly / first-news-app-screen.sh
Last active August 29, 2015 13:56
first-news-app
$ git push origin gh-master
error: src refspec gh-master does not match any.
error: failed to push some refs to 'git@github.com:jheasly/first-news-app.git'
...
$ git push
fatal: The current branch gh-pages has no upstream branch.
To push the current branch and set the remote as upstream, use
@jheasly
jheasly / rtlsdr-osx.txt
Last active February 26, 2021 04:02 — forked from 0xabad1dea/rtlsdr-osx.txt
Build RTL-SDR on OSX with no tears using homebrew. Forked from https://gist.github.com/0xabad1dea/5777726, a macports solution.
rtl-sdr build notes for OSX
using macports http://www.macports.org/
see http://sdr.osmocom.org/trac/wiki/rtl-sdr
brew install cmake
brew install libusb
brew install pkgconfig
brew install sox # for easy audio
git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr/
@jheasly
jheasly / flip-sort.py
Created December 20, 2014 02:06
Attempt to connect to Tarbell Google spreadsheet
# -*- coding: utf-8 -*-
import getpass
import httplib2
import gspread
from apiclient import discovery
from oauth2client import keyring_storage
'''
Almost entirely cribbed from tarbell/oauth.py
@jheasly
jheasly / non_utf_16le_encoded_object_list.py
Last active August 29, 2015 14:21
Non-encoded object_list
from django.views.generic.list_detail import object_list
from foo.models import Baz
...
def foo(request):
response = object_list(
request,
queryset = Baz.objects.order_by('date'),
template_name = 'my_template.html',