- 
jq — https://jqlang.org/ — "like sed for JSON data" There are several options available for installing jq. I prefer to use Homebrew: brew install jq
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | var express = require('express'); | |
| var cookieParser = require('cookie-parser'); | |
| var session = require('express-session'); | |
| var flash = require('express-flash'); | |
| var handlebars = require('express-handlebars') | |
| var app = express(); | |
| var sessionStore = new session.MemoryStore; | |
| // View Engines | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // Returns the value at a given percentile in a sorted numeric array. | |
| // "Linear interpolation between closest ranks" method | |
| function percentile(arr, p) { | |
| if (arr.length === 0) return 0; | |
| if (typeof p !== 'number') throw new TypeError('p must be a number'); | |
| if (p <= 0) return arr[0]; | |
| if (p >= 1) return arr[arr.length - 1]; | |
| var index = (arr.length - 1) * p, | |
| lower = Math.floor(index), | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def dict_to_item(raw): | |
| if type(raw) is dict: | |
| resp = {} | |
| for k,v in raw.iteritems(): | |
| if type(v) is str: | |
| resp[k] = { | |
| 'S': v | |
| } | |
| elif type(v) is int: | |
| resp[k] = { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import pandas as pd | |
| import numpy as np | |
| def find_correlation(data, threshold=0.9, remove_negative=False): | |
| """ | |
| Given a numeric pd.DataFrame, this will find highly correlated features, | |
| and return a list of features to remove. | |
| Parameters | |
| ----------- | |
| data : pandas DataFrame | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/bin/bash | |
| # variables | |
| LOGFILE="/var/log/nginx/access.log" | |
| LOGFILE_GZ="/var/log/nginx/access.log.*" | |
| RESPONSE_CODE="200" | |
| # functions | |
| filters(){ | |
| grep $RESPONSE_CODE \ | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import torch | |
| from torchvision import datasets | |
| class ImageFolderWithPaths(datasets.ImageFolder): | |
| """Custom dataset that includes image file paths. Extends | |
| torchvision.datasets.ImageFolder | |
| """ | |
| # override the __getitem__ method. this is the method that dataloader calls | |
| def __getitem__(self, index): | 
      
      Loading
      
  Sorry, something went wrong. Reload?
      Sorry, we cannot display this file.
      Sorry, this file is invalid so it cannot be displayed.
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/usr/bin/env python | |
| import argparse | |
| import string | |
| from PIL import Image, ImageFont, ImageDraw | |
| from operator import itemgetter | |
| def image(string): | |
| '''catch the IOError if Image.open() goes screwy and raise a nicely formatted | |
| argparse error instead''' |