Use youtube-dl directly to download the video (thanks @meepybub!) Example:
youtube-dl -u <[email protected]> "https://vimeo.com/ondemand/<video>"
(set! *warn-on-reflection* true) | |
(require '[clojure.edn :as edn]) | |
(require '[clojure.core.protocols :refer [Datafiable]]) | |
(require '[clojure.datafy :as datafy]) | |
(require '[clojure.java.io :as io]) | |
(import '(java.io StringReader PushbackReader)) | |
(import '(java.time LocalDateTime)) | |
(import '(java.time.format DateTimeFormatter)) |
#!/bin/sh | |
#_( | |
true; exec clj -J-Xmx256M -J-XX:-OmitStackTraceInFastThrow -Sdeps "`sed -n -e '/;;(DEPS$/,/;;DEPS)$/p' $0`" -M -i $0 -e '(user/main)' | |
) | |
(ns user | |
#?(:cljs (:require-macros [user :as m])) | |
(:require | |
#?@(:clj ([cljs.build.api :as cljs] |
Use youtube-dl directly to download the video (thanks @meepybub!) Example:
youtube-dl -u <[email protected]> "https://vimeo.com/ondemand/<video>"
A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.
How to use:
(ns util.natural-sorting | |
(:refer-clojure :exclude [sort sort-by]) | |
(:require [clojure.string])) | |
(defn parse-int [s] | |
#?(:clj (Long/parseLong s) | |
:cljs (js/parseInt s))) | |
(defn vector-compare [[value1 & rest1] [value2 & rest2]] | |
(let [result (compare value1 value2)] |
class TransactionAwareTask(Task): | |
''' | |
Task class which is aware of django db transactions and only executes tasks | |
after transaction has been committed | |
''' | |
abstract = True | |
def apply_async(self, *args, **kwargs): | |
''' | |
Unlike the default task in celery, this task does not return an async |
TL;DR
Install Postgres 9.6, and then:
sudo pg_dropcluster 9.6 main --stop
sudo pg_upgradecluster 9.5 main
sudo pg_dropcluster 9.5 main
curl --include \ | |
--no-buffer \ | |
--header "Connection: Upgrade" \ | |
--header "Upgrade: websocket" \ | |
--header "Host: example.com:80" \ | |
--header "Origin: http://example.com:80" \ | |
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \ | |
--header "Sec-WebSocket-Version: 13" \ | |
http://example.com:80/ |
# !/usr/bin/env bash | |
# File path should be ./bin/post_compile | |
# (.sh extension added in Gist just to enable shell syntax highlighting. | |
# https://discussion.heroku.com/t/django-automaticlly-run-syncdb-and-migrations-after-heroku-deploy-with-a-buildpack-or-otherwise/466/7 | |
echo "=> Performing database migrations..." | |
python manage.py migrate |
import gc | |
def queryset_iterator(qs, batchsize = 500, gc_collect = True): | |
iterator = qs.values_list('pk', flat=True).order_by('pk').distinct().iterator() | |
eof = False | |
while not eof: | |
primary_key_buffer = [] | |
try: | |
while len(primary_key_buffer) < batchsize: | |
primary_key_buffer.append(iterator.next()) |