Skip to content

Instantly share code, notes, and snippets.

View newsomc's full-sized avatar

Clint Newsom newsomc

View GitHub Profile
@newsomc
newsomc / gist:3b74863a6ab29de8d4b65b3f41cc38b7
Created May 30, 2018 19:38 — forked from tayvano/gist:6e2d456a9897f55025e25035478a3a50
complete list of ffmpeg flags / commands
Originall From: Posted 2015-05-29 http://ubwg.net/b/full-list-of-ffmpeg-flags-and-options
This is the complete list that’s outputted by ffmpeg when running ffmpeg -h full.
usage: ffmpeg [options] [[infile options] -i infile]… {[outfile options] outfile}…
Getting help:
-h — print basic options
-h long — print more options
-h full — print all options (including all format and codec specific options, very long)
(defn computer-down? [{{computer-y :y} :computer
{ball-y :y} :ball player-height :player-height :as state}]
(and (> (- computer-y 20) ball-y) (>= (- computer-y (/ player-height 2)) 0)))
;; vs.
(defn computer-down? [{:keys [ball computer] :as st}]
(let [cy (:y computer)]
(and (> (- cy 20) (:y ball))
(>= (- cy (/ (:player-height st) 2)) 0))))
@newsomc
newsomc / core.clj
Created September 9, 2013 14:54 — forked from llasram/core.clj
(ns lenskit-hello.core
(:require [clojure.java.io :as io])
(:import [org.grouplens.lenskit
ItemRecommender ItemScorer Recommender RecommenderBuildException]
[org.grouplens.lenskit.baseline
BaselineScorer ItemMeanRatingItemScorer UserMeanBaseline
UserMeanItemScorer]
[org.grouplens.lenskit.core
LenskitConfiguration LenskitRecommender]
[org.grouplens.lenskit.cursors Cursors]
options("repos"="http://cran.us.r-project.org")
library("rgdal")
myPolygons = readOGR("/path/to/file",layer="mylayer")
alpha=0.75
library(alphahull)
pts = spsample(myPolygons, n=1000, type="regular")
x.as = ashape(coordinates(pts),alpha=alpha)
# need to convert x.as to a SpatialPolygon
# code to convert ahull into sp:
(ns hs-js-clj.core)
(def foo {:bar 1})
(defn fooify [n] (str "foo" n))
(defn commaify [[x y]]
(str x ", " y))
console.log("hello");
function LazySeq(head, tail) {
this.head = head; // value
this.tail = tail; // thunk || null
}
function ints(n) {
return new LazySeq(n, function() { return ints(n+1); });
}
var aliens = [{}, {}, {}];
var aliensCollidingWithPlayer = [];
for (var i = 0; i < aliens.length; i++) {
if(colliding(alien[i], player)) { // is colliding current tick
var collidingInPreviousTick = false;
for (var j = 0; j < aliensCollidingWithPlayer.length; j++) {
if (aliens[i] === aliensCollidingWithPlayer[j]) {
collidingInPreviousTick = true;
break;
four primitives: run*, ==, conde, fresh
(run* (q)
(== q #t))
; for what values of q is q equal to true?
answer: q must also be #t, so
'(#t) ; answer comes back in a list
# time
# ====
macro time(ex)
quote
local t0 = time_ns()
local val = $(esc(ex))
local t1 = time_ns()
println("elapsed time: ", (t1-t0)/1e9, " seconds")
val