Skip to content

Instantly share code, notes, and snippets.

Nick Jones nrjones8

Block or report user

Report or block nrjones8

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
word = 'ravenclaw'
house = \
'Gryffindor' if 'gryffindor' in word else \
'Hufflepuff' if 'hufflepuff' in word else \
'Ravenclaw' if 'ravenclaw' in word else \
'Slytherin' if 'slytherin' in word else \
'some default value'
print house
nrjones8 /
Last active Jul 17, 2018
BART Weekday Ridership, by Starting Station (May, 2018)

The above visualization breaks down all weekday rides on BART by their starting station. Clicking on an individual station will zoom in, showing the distribution of destination stations for that starting station.

BART provides monthly ridership data for all stations pairs - i.e. the average number of people who rode from station A to station B. They publish these datasets on their website in .xlsx format. Those files are combined into one flat CSV in a separate repo, which is where the data used in this visualization came from.

nrjones8 / zero_offset_utc.php
Created Aug 24, 2016
PHP's interpretation of RFC 3339 serialization of a UTC timestamp
View zero_offset_utc.php
$timezone = new \DateTimeZone('UTC');
$needed_time = new \DateTime('2019-11-06 18:20:56', $timezone);
echo $needed_time->getTimezone()->getName() . "\n";
echo $needed_time->format(DATE_RFC3339) . "\n";
// Output (note the +00:00 instead of "Z")
// UTC
nrjones8 /
Created Apr 13, 2015
Notes from a few talks at Pycon

Building Secure Systems -- lvh

  • High level
  • Bugs --> security bugs --> particularly bad
  • "Tools" don't work for security
  • Unit tests don't catch it
  • Using some the docs?
  • Google/SO don't always have best answers
  • Good practice ~= bad practice
  • Process is different in security:
    • Install it
nrjones8 / abstract_statics.php
Created Mar 24, 2015
PHP's abstract static functions
View abstract_statics.php
abstract class AbstractClass {
abstract protected static function Something();
class GoodExtender extends AbstractClass {
protected static function Something() {
echo "something!\n";
nrjones8 / php_56_assignment.php
Created Feb 25, 2015
invalid syntax before PHP 5.6
View php_56_assignment.php
class Foo {
private $some_var = 'concatenated ' . 'str';
$foo = new Foo();
nrjones8 /
Created Jan 20, 2015
A few examples of how a client would interact with ApiClient
class MatchedResponseCode(object):
def __init__(self, expected_status_codes, status_code):
self.expected_status_codes = expected_status_codes
self.status_code = status_code
self.codes_handled = set()
def __enter__(self):
return self
def __exit__(self, exc_type, exc_value, exc_tb):
import bs4 as bs
import requests as r
import re
import pandas as pd
SCORE_RE = r'[0-9]*\-[0-9]*$'
TIMESTAMP_RE = r'[0-9]*:[0-9]*$'
nrjones8 /
Last active Aug 29, 2015
Simple Sublime Text 2 plugin to sync local files with remote ones via SCP. A simple workaround for lack of a free SFTP library that could be extended/made more robust.
import sublime, sublime_plugin
import sys
# Sublime has its own embedded Python interpreter -- we need to tell it explicitly
# to find installed 3rd party libraries (like paramiko)
PYTHON_PACKAGES_PATH = '/Library/Python/2.7/site-packages'
from paramiko import SSHClient
from scp import SCPClient
You can’t perform that action at this time.