Skip to content

Instantly share code, notes, and snippets.

View jonathansick's full-sized avatar

Jonathan Sick jonathansick

View GitHub Profile
@jonathansick
jonathansick / mockregistry.py
Created August 15, 2019 20:34
Using the MockRegistryApi
# In unit tests =====================================
from kafkit.registry.sansio import MockRegistryApi
# The Avro schema that you'll be testing with
schema = {}
# The MockRegistryApi works just like the RegistryApi, but doesn't
# do any network requests.
registryclient = MockRegistryApi()
@jonathansick
jonathansick / newtopics.py
Last active August 15, 2019 19:04
Creating Kafka topics
from confluent_kafka.admin import AdminClient, NewTopic
default_num_partitions = 1
default_replication_factor = 3
client = AdminClient({
'bootstrap.servers': 'url...'
})
# First list existing topics
@jonathansick
jonathansick / query.graphql
Last active January 20, 2024 07:58
GitHub GraphQL repo commit history query
{
repository(name: "sickvim", owner: "jonathansick") {
ref(qualifiedName: "master") {
target {
... on Commit {
id
history(first: 5) {
pageInfo {
hasNextPage
}
@jonathansick
jonathansick / Cubehelix Demo.ipynb
Created April 27, 2015 02:28
Palettable Cubehelix Demo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jonathansick
jonathansick / archive_of_astro_comm.md
Last active August 29, 2015 14:16
A proposed workflow for the Archive of Informal Astronomy Communications
  • There is an "Archive of Informal Astronomy Communications" (name TBD);
    • The Archive has an editor and board that is backed by astro libraries and the AAS or similar organizations,
    • The Archive is fundamentally a Zenodo curated community,
    • ADS agrees to index the resources of this Zenodo community,
    • Astronomy blogs apply for affiliation with the Archive as authors (or use an arXiv-like endorsement model).
  • The blogger posts an article as usual.
  • Only if the blogger deems the post to be relevant to scholarly astronomy discourse do they intentionally submit their article to the Zenodo community (i.e., submission is not automatic so that a grad student who normally blogs astronomy research doesn't get that one blog post about a Taylor Swift concert indexed by ADS). This also implies that articles can be retroactively submitted.
  • The submission consists of the post's content. There is no prescribed format, but it should be easily and openly readable, e.g., plaintext/markdown and images or an ipy
@jonathansick
jonathansick / multipix_daft.ipynb
Last active August 29, 2015 14:06
Probabilistic Graphical Model of Multi-Pixel SEDs drawn in Daft
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Keybase proof

I hereby claim:

  • I am jonathansick on github.
  • I am jsick (https://keybase.io/jsick) on keybase.
  • I have a public key whose fingerprint is 2175 1D47 7F2A 78C3 D6AF A6E9 F210 C97A 0D74 0AA6

To claim this, I am signing this object:

@jonathansick
jonathansick / pix_scale.py
Created June 3, 2014 19:50
Flexible pixel scale
if 'CDELT' in header:
pix_scale header['CDELT'] * 3600.
else:
pix_scale = np.sqrt(header['CD1_1'] ** 2. + header['CD1_2'] ** 2.) * 3600.
@jonathansick
jonathansick / pypi_checklist.md
Last active August 29, 2015 14:02
A checklist for uploading to PyPI, because I always forget.

First time:

python setup.py register

Uploading a new version:

python setup.py check
@jonathansick
jonathansick / jsick_postgresql.conf
Created May 15, 2014 19:28
postgresql.conf Postgres Config File Customizations
# It's convenient to put all postgresql.conf customizations in a included file.
# From bottom postgresql.conf, include as
# include = 'path/to/jsick_postgresql.conf'
# NOTE: you may need to customize some of these columns.
# Note: Increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction).
max_connections = 100 # (change requires restart)
# Logging