Skip to content

Instantly share code, notes, and snippets.

View j6k4m8's full-sized avatar
🧠
hi

Jordan Matelsky j6k4m8

🧠
hi
View GitHub Profile
@j6k4m8
j6k4m8 / data.Nov-2-2017.json
Last active November 3, 2017 01:46
Activity on 365papers tweets, re: media
{
"data": [{"id": "926202781534388224", "has_media": true, "favorites": 0, "retweets": 0}, {"id": "925899260981399553", "has_media": false, "favorites": 0, "retweets": 0}, {"id": "925466309869043714", "has_media": false, "favorites": 2, "retweets": 0}, {"id": "925107363782283269", "has_media": true, "favorites": 1, "retweets": 0}, {"id": "924714332591620097", "has_media": false, "favorites": 2, "retweets": 0}, {"id": "924327510124441602", "has_media": false, "favorites": 0, "retweets": 0}, {"id": "923986889803223040", "has_media": false, "favorites": 2, "retweets": 1}, {"id": "923752187288870914", "has_media": false, "favorites": 0, "retweets": 0}, {"id": "923376386047344640", "has_media": false, "favorites": 0, "retweets": 0}, {"id": "923017521296543744", "has_media": false, "favorites": 0, "retweets": 0}, {"id": "922573311799975936", "has_media": false, "favorites": 0, "retweets": 0}, {"id": "922210485453426691", "has_media": false, "favorites": 0, "retweets": 0}, {"id": "921818671022051333", "has_media
@j6k4m8
j6k4m8 / NiceNotebooks.md
Last active December 12, 2021 01:50
How to write friendly Jupyter Notebooks

Jupyter Notebook Conventions

Manifesto

Notebooks are designed for easy reproducibility and code-sharing. Babysitting and debugging someone else's notebook sucks. Don't curse your friends with this burden!

When a user opens your notebook, they should be able to run all cells in order without any additional intervention.

Inputs that must be made to enable the code to run (e.g. password prompts, API tokens, etc) should be requested as soon as the notebook starts running.

@j6k4m8
j6k4m8 / git-nicely.md
Last active June 27, 2019 23:04
How to git nicely with others

How to Git Nicely

Pull latest master.

git checkout master
git pull origin master

Check out a new feature-branch.

@j6k4m8
j6k4m8 / ipinfo
Last active September 21, 2017 20:40
Python: Get local, global, or router IP from the command line
#!/usr/bin/env python3
"""
Usage:
./ipinfo [router|local|global]
./ipinfo geo [ip]
For example, to get your OWN location:
./ipinfo geo $(ipinfo global)
@j6k4m8
j6k4m8 / statestore.md
Last active February 4, 2017 15:54
Use the URL as a backend to store statefulness. Reading from the URL on a subsequent pageload will restore the state as you left it previously.

Usage

DEPRECATED: Use this instead, which is all this and more!!

Say you have a website example.com.

setState('answer', 42);
@j6k4m8
j6k4m8 / python-color-print.md
Last active February 4, 2017 15:54
Prints in a color, or bolded, or formatted.

Pretty-print in python.

pretty_print([RED, UNDERLINE], "DANGER!")
print(
    pretty_format([YELLOW], "Careful!"),
 "Are you sure you want to do the thing?"
@j6k4m8
j6k4m8 / graphml-to-json.py
Last active October 26, 2016 14:11 — forked from anderser/convert.py
Convert from NodeXL (via GraphML-format) to D3-ready json for force layout while adding modularity groups (communities) as attribute to nodes. Useful for coloring nodes via modularitygroup attribute. Requires networkx and python-louvain. First export as GraphML file from your NodeXL-sheet. Then run: >>> python convert.py -i mygraph.graphml -o ou…
#!/usr/bin/env python
import sys
import argparse
import networkx as nx
import community
from networkx.readwrite import json_graph
import json
#!/bin/bash
# Stolen ahem I mean borrowed from @gkiar
rawdir='HCP900/raw'
cd ${rawdir}
for i in `ls `;
do
# For general operation
sudo apt-get install build-essential git-core pkg-config automake libtool wget zlib1g-dev python-dev libbz2-dev
# For regression test suite:
sudo apt-get install libsoap-lite-perl
# Clone the source
git clone https://github.com/moses-smt/mosesdecoder.git mosesdecoder
cd mosesdecoder
@j6k4m8
j6k4m8 / genobj.py
Created March 6, 2016 05:07
Generates a 3D .obj from a neurodata (neurodata.io) token/channel pair.
#!/usr/bin/env python
"""
Written by Jordan Matelsky (@j6k4m8)
March 5, 2016
"""
import sys
import os
import argparse