Skip to content

Instantly share code, notes, and snippets.

View codersquid's full-sized avatar

Sheila Miguez codersquid

View GitHub Profile
{
"properties": {
"metadata": {
"required": "true",
"type": "object",
"description": "collection metadata",
"properties": {
"from": {
"type": "number",
"description": "the starting record if currently showing a subset - see query key"
@codersquid
codersquid / default.json
Last active August 29, 2015 13:58
compendiafied pizza.py
{
"rsvp_count": 50,
"verbose": "true",
"meetup_universal_constant": 0.65,
"appetite": 2.5,
"pizza_divisor": 8,
"toppings_distribution": {
"vegan": 0.03,
"meat": 0.33,
"veg": 0.45
@codersquid
codersquid / sched.py
Created May 16, 2014 18:56
one-off script to load up a lot of room slots with breaks
#!/usr/bin/env python
import os
import argparse
import csv
from datetime import datetime
import time
"""
@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:
@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:

{