Skip to content

Instantly share code, notes, and snippets.

View knowsuchagency's full-sized avatar
💭
hustlin'

Stephan Fitzpatrick knowsuchagency

💭
hustlin'
View GitHub Profile
@knowsuchagency
knowsuchagency / example.script
Last active December 5, 2016 22:58
pair client server example
Script started on Mon 05 Dec 2016 02:54:46 PM PST
[sfitzpa1@hills pair]$ ls
example.script users_client.py users_service.py
[sfitzpa1@hills pair]$ echo "Run server in background by appending & to command" && ./users_service.py &
[1] 7158
[sfitzpa1@hills pair]$ Run server in background by appending & to command
running server:
echo "Communicate with server using client script" && ./users_client.py fitz boyd
Communicate with server using client script
127.0.0.1 - - [05/Dec/2016 14:55:41] "GET /?strings=fitz,boyd HTTP/1.1" 200 -
@knowsuchagency
knowsuchagency / vcard.sh
Created December 9, 2016 01:42
vcard example
#!/usr/bin/env bash
# vcard generation utility
# first argument is the file to be written to. It will be appended to with each new write.
# ex: $./vcard card
printWrite() {
# Take printf formatted string, append newline, and write to stdout and stderr
printf "$1\n" | tee /dev/fd/2
@knowsuchagency
knowsuchagency / shwifty.swift
Created December 17, 2016 00:51
code for initial view controller
//
// VotesTableViewController.swift
// Voting
//
// Created by Stephan Fitzpatrick on 12/16/16.
// Copyright © 2016 Stephan Fitzpatrick. All rights reserved.
//
import UIKit
@knowsuchagency
knowsuchagency / typecheck.py
Last active January 22, 2024 12:19
A cell magic to enable the use of mypy within jupyter notebooks
"""
Add mypy type-checking cell magic to jupyter/ipython.
Save this script to your ipython profile's startup directory.
IPython's directories can be found via `ipython locate [profile]` to find the current ipython directory and ipython profile directory, respectively.
For example, this file could exist on a path like this on mac:
/Users/yourusername/.ipython/profile_default/startup/typecheck.py
@knowsuchagency
knowsuchagency / integrals.ipynb
Last active May 1, 2017 00:30
right hand sum, left hand sum, and integration example in Python
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@knowsuchagency
knowsuchagency / Untitled142.ipynb
Created May 17, 2017 06:55
consumer_producer_stuff
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@knowsuchagency
knowsuchagency / delicious_recipe.py
Last active May 23, 2017 23:27
transaction manager recipe for pyramid sqlalchemy session
from contextlib import contextmanager
from functools import singledispatch, partial
from pathlib import Path
import pkg_resources
# development config uri for base distribution
DEVELOPMENT_CONFIG_URI = pkg_resources. \
get_distribution('distribution_package_name').get_resource_filename(
@knowsuchagency
knowsuchagency / Untitled146.ipynb
Last active May 23, 2017 22:11
Single dispatch context manager recipe
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@knowsuchagency
knowsuchagency / zodb experimentation.ipynb
Created May 24, 2017 04:32
zodb experimentation.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@knowsuchagency
knowsuchagency / scopes and reference semantics things.ipynb
Created May 24, 2017 18:20
scopes_and_reference_semantics.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.