Skip to content

Instantly share code, notes, and snippets.

  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@roaffix
roaffix / soccer_cuts.py
Created November 7, 2018 12:46 — forked from Zulko/soccer_cuts.py
A python script to automatically summarize soccer videos based on the crowd's reactions
#
# This Python script makes a summary of a football game by cutting
# the video around the 10 % loudest moments, which generally
# include the goals and other important events.
# For more details, see this blog post:
# http://zulko.github.io/blog/2014/07/04/automatic-soccer-highlights-compilations-with-python/
#
# LICENCE: Creative Commons 0 - Public Domain
# I, the author of this script, wave any rights and place this work in the public domain.
#
@roaffix
roaffix / data_loader.py
Created May 8, 2018 14:09 — forked from kevinzakka/data_loader.py
Train, Validation and Test Split for torchvision Datasets
"""
Create train, valid, test iterators for CIFAR-10 [1].
Easily extended to MNIST, CIFAR-100 and Imagenet.
[1]: https://discuss.pytorch.org/t/feedback-on-pytorch-for-kaggle-competitions/2252/4
"""
import torch
import numpy as np
@roaffix
roaffix / dataloader.py
Created May 8, 2018 14:07 — forked from justusschock/dataloader.py
Gist to show examples of doing own dataloader and imagefolder in pytorch
class DataLoader(object):
def __init__(self, options, data_path, load_fkt, shuffle, return_paths):
self.pairedData = None
self.initialize(options, load_fkt, data, shuffle, return_paths)
def initialize(self, options, load_fkt, data_path, shuffle, return_paths):
pass
@roaffix
roaffix / joblib_parallel.py
Created April 6, 2018 12:35
joblib parallel
from joblib import Parallel, delayed
def split_list(list_, parts=1):
return [list_[i * len(list_) // parts: (i + 1) * len(list_) // parts] for i in range(parts)]
def function(list_):
# function body
return # something