Skip to content

Instantly share code, notes, and snippets.

View cuibonobo's full-sized avatar

Jen Garcia cuibonobo

View GitHub Profile
@cuibonobo
cuibonobo / mongo-river-analyzer.sh
Created April 4, 2014 14:30
Creating a mongo river using a particular analyzer
# Make sure you DELETE `/mongoindex` and `/_river/mongoindex` if they exist already
# Create the index
PUT /mongoindex
# Create the mapping that defines your analyzers
PUT /mongoindex/assets/_mapping
{
"assets": {
"properties": {
@cuibonobo
cuibonobo / mongo-restructure-field.py
Created April 5, 2014 21:03
Restructure the content field of a record in Mongo
import pymongo
# Set up your database
conn = pymongo.Connection()
db = conn.eve
coll = db.assets
# Find every record that contains a content field
change_list = list(coll.find({"content":{"$exists":True}}))
@cuibonobo
cuibonobo / long-processes.md
Created April 10, 2014 15:04
Detect when a long-running process ends
@cuibonobo
cuibonobo / bluetooth_kivy.py
Last active October 10, 2023 12:19 — forked from tito/bluetooth.py
Bluetooth example with Kivy. A more fleshed-out example here: https://github.com/tito/android-demo. A more modern way of doing it: https://github.com/kivy/plyer. And this guy used Kivy to connect to an Arduino: https://github.com/brean/arduino-kivy-bluetooth. Native Kivy code (?): https://groups.google.com/d/msg/kivy-users/n_cMbFzf_1A/5edKgQgycx0J
# Same as before, with a kivy-based UI
'''
Bluetooth/Pyjnius example
=========================
This was used to send some bytes to an arduino via bluetooth.
The app must have BLUETOOTH and BLUETOOTH_ADMIN permissions (well, i didn't
tested without BLUETOOTH_ADMIN, maybe it works.)
@cuibonobo
cuibonobo / dockless-adium.sh
Created April 14, 2014 04:42
Run Adium without a dock icon. To generate a certificate, go here: https://developer.apple.com/library/mac/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html#//apple_ref/doc/uid/TP40005929-CH4-SW1 and navigate to the "To use the Certificate Assistant to create a self-signed signing identity" section.
# This sets the application to dockless
defaults write /Applications/Adium.app/Contents/Info LSUIElement 1
# This signs the application with a certificate in your keychain
codesign -f -s "Jen Montes" /Applications/Adium.app
@cuibonobo
cuibonobo / eve-inconsistent-etag.sh
Created April 15, 2014 12:31
different etags problem (bug?)
$ curl -X POST -H "Content-Type: application/json" --data @task.json -H 'Content-Type: application/json' http://127.0.0.1:5000/api/tasks
{"_updated": "15 Apr 2014 12:27:47", "_status": "OK", "_id": "534d25c3b3af65af6b51bb53", "_links": {"self": {"href": "/tasks/534d25c3b3af65af6b51bb53", "title": "task"}}, "_etag": "e7411dc170591300ecc66078b941ac371cfea1b2"}
$ curl http://127.0.0.1:5000/api/tasks/534d25c3b3af65af6b51bb53
{"_updated": "15 Apr 2014 12:27:47", "name": "task", "author": "534d2371b3af65af6dcb5189", "_links": {"self": {"href": "/tasks/534d25c3b3af65af6b51bb53", "title": "task"}, "parent": {"href": "", "title": "home"}, "collection": {"href": "/tasks", "title": "tasks"}}, "_created": "15 Apr 2014 12:27:47", "_id": "534d25c3b3af65af6b51bb53", "type": "ai", "_etag": "38337469dab3827c4f71b8a51a570a21ffc51480"}
@cuibonobo
cuibonobo / git-changelog.html
Created April 15, 2014 13:43
Generating changelogs with git
<html>
<head>
<title>ChangeLog</title>
<style type="text/css">
code {
display: block;
padding: 1em 1em 1em 2em;
background-color: #f8f8f8;
border: 1px solid #f0f0f0;
width: 50em;
@cuibonobo
cuibonobo / public-domain.md
Last active August 29, 2015 13:59
Public domain dedication for a website that may have content from other authors.

Except where otherwise noted, all original content on this site was created by Jen Montes and is dedicated to the public domain (CC0). All other marks, names, and copyrighted materials are property of their respective owners.

@cuibonobo
cuibonobo / arbitrary-key-schema-check.py
Created April 21, 2014 20:03
From frathgeber on IRC: i have a dictionary field with arbitrary keys, but each of those keys must contain a dictionary of a given schema
class KeySchemaValidator(Validator):
def _validate_keyschema(self, schema, field, dct):
"Validate all keys of dictionary ``dct`` against schema ``schema``."
for key, value in dct.items():
self._validate_schema(schema, key, value)
api = Eve(API_NAME, validator=KeySchemaValidator)
  • Always-available site toolbar along the top. Twitter and Facebook are also doing this.
  • Breadcrumb menu establishes where you are and gives a visual cue to the max width of the content.
  • Content has ample margins on either side for readability and to give space for asides and footnotes. (The notebook design I'm getting inspiration from only gives enough margin space for the input/output prompts, and only on the left side, but I took the idea to its logical, beautiful conclusion. Tufte would be proud.)
  • Menu, breadcrumb, and footer follow a different, lower-contrast color scheme than the content. It's subtle but gorgeous.
  • Consistent baseline alignment across content, code, and asides.
  • The chrome of the page doesn't try to invade the content space: you have navigational information at the top, meta information at the bottom, but everything in between is just the content. Challenges the idea of sidebars as a necessary component of web page navigation.