Skip to content

Instantly share code, notes, and snippets.

View codersquid's full-sized avatar

Sheila Miguez codersquid

View GitHub Profile
@codersquid
codersquid / rooms.csv
Last active August 29, 2015 14:02
help me with the symposion schedule grid
section_slug name order
talks-posters Grand Ballroom 0
talks-posters Room 203 1
talks-posters Room 204 2
tutorials Room 101 0
tutorials Room 102 1
tutorials Room 105 2
tutorials Room 106 3
bofs Grand Ballroom 0
bofs Room 203 1
@codersquid
codersquid / bitlyfy.py
Last active August 29, 2015 14:03
one-offs to generate a csv file from symposion Presentations and generate bitly links for them. very sloppy at the moment.
#!/usr/bin/env python
import os, urllib
import bitly_api
import csvify
import secrets
class BitlyPresentations:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="""
I never freaking remember argparse syntax and the docs are so all over the place
that I need this for an example.
@codersquid
codersquid / example.json
Created August 10, 2014 16:30
ia-wrapper UnicodeEncodeError example using http://video.ep14.c3voc.de/3.mp4
{
"3": {
"abstract": "Lessons learned when building a client for a fully distributed system and trying to minimize context-switching pains when using multiple languages.",
"collection": "opensource_movies",
"conference": "EuroPython 2014",
"date": "2014-07-24T14:00:00+0200",
"description": "Last year we decided to create official clients for the most popular languages, Python included.\r\n\r\nSome of the goals were:\r\n\r\n* support the complete API of elasticsearch including all parameters\r\n* provide a 1-to-1 mapping to the rest API to avoid having opinions and provide a familiar interface to our users consistent across languages and evironments\r\n* degrade gracefully when the es cluster is changing (nodes dropping out or being added)\r\n* flexibility - allow users to customize and extend the clients easily to suit their, potentially unique, environment\r\n\r\nIn this talk I would like to take you through the process of designing said client, the challenges
@codersquid
codersquid / clobberempty.py
Last active August 29, 2015 14:05
example to show that a subsequent upload of an ia-wrapper Item will show metadata from a previous Item.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import internetarchive as ia
import os
from tempfile import NamedTemporaryFile
ACCESS_KEY = os.environ.get('IAS3_ACCESS_KEY')
SECRET_KEY = os.environ.get('IAS3_SECRET_KEY')
@codersquid
codersquid / matchdoi.py
Created September 8, 2014 18:39
scan a file to parse out the dois
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
def match_doi(query):
""" match doi from query """
# pattern is from a very helpful SO question. I <3 SO
# http://stackoverflow.com/questions/27910/finding-a-doi-in-a-document-or-page
match = re.search(r'\b(10[.][0-9]{4,}(?:[.][0-9]+)*/(?:(?!["&\'<>])\S)+)\b', query)
@codersquid
codersquid / search_channel.py
Last active August 29, 2015 14:08
code samples to get video metadata from PyCon Taiwan youtube channel
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
from steve.util import (
get_from_config,
get_project_config,
save_json_files
)
from apiclient.discovery import build

I hereby claim:

  • I am codersquid on github.
  • I am codersquid (https://keybase.io/codersquid) on keybase.
  • I have a public key whose fingerprint is 73BE 52A0 5FC7 5DAC 8EAC 2911 E5FF 3C81 AD16 8F70

To claim this, I am signing this object:

{
@codersquid
codersquid / foo.md
Last active August 29, 2015 14:26
this is an example

header

  • one
  • two
  • three

hello

foo

@codersquid
codersquid / archive.py
Created August 10, 2015 15:12
example scripts so that you can see making an item on archive.org with metadata for that item
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
I had a script to upload some conference files to archive.org a while back, and I can't remember
if this is the file I used. It could be. It's very krufty. Also, the internetarchive package has
reved a few times since.
this is only for an example
"""