Skip to content

Instantly share code, notes, and snippets.

@Deraen
Deraen / angular-filesize.js
Last active July 5, 2017 15:14 — forked from thomseddon/gist:3511330
Humanize filesize
app.filter('bytes', function() {
return function(bytes, precision) {
if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) return '-';
if (typeof precision === 'undefined') precision = 1;
var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'];
var number = Math.floor(Math.log(bytes) / Math.log(1024));
return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number];
};
});
(ns racehub.om.facebook
(:require [cljs.core.async :as a]
[racehub.schema :as rs]
[schema.core :as s :include-macros true]))
;; ## Utilities
(defn prune
"Takes a mapping of keys -> new key names and a map and returns a
map with nils removed and keys swapped where they're present in the
@pleasetrythisathome
pleasetrythisathome / nashorn.clj
Last active August 29, 2015 14:10
nashorn cljs rendering
(ns starlab.services.nashorn
(:require [clojure.tools.logging :as log]
[clojure.java.io :as io])
(:import [javax.script
Invocable
ScriptEngineManager])
(:use [plumbing.core :exclude [update]]))
(defn nashorn-env []
(doto (.getEngineByName (ScriptEngineManager.) "nashorn")
(page "index.html"
(:require
[tailrecursion.hoplon.reload :refer [reload-all]]))
(reload-all 0)
(defn random-minefield [size n]
(loop [mines #{}]
(if (< (count mines) n)
(recur (conj mines [(rand-int size) (rand-int size)]))

Last updated: 2017-03-18

Searching for Files

Find images in a directory that don't have a DateTimeOriginal

exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' .

###Output photos that don't have datetimeoriginal to a CSV### Note this can take a long time if you have a lot of jpgs

@kgabis
kgabis / dropboxpro.md
Last active May 18, 2016 22:03
Weird pricing of Dropbox Pro

Last week Dropbox introduced Dropbox Pro with 1TB storage space (and some other cool features) for $99/year (or $9,99/month), which is a pretty good deal (Google Drive 1TB also costs $99,99/year). The problem: it's not $99/year, but $130/year (or $13/month) if you happen to live in Europe. Instead of converting prices from dollars to euros, they just changed $ to €.

pricing

But that's not the best part. You can buy it cheaper if you use Dropbox app on iOS.

pricing on iOS

Now it's only $118/year or $10/month, which is much cheaper than through their website (and they still have to give 30% of that to apple!). I guess we should thank apple for not allowing different pricing in different regions. So if you plan to upgrade to Dropbox Pro, do it through their mobile app.

@jnovack
jnovack / README.md
Last active April 3, 2024 03:24
Opening up mosh in firewalld using firewall-cmd

Mosh (mobile shell) is a gift from the Gods(tm). Anyone with spotty internet or wireless connection has suffered the pain of a lost SSH session. Sure, one can fire up screen (or tmux as the kids are using these days), but that's an extra step and you are still using the SSH protocol.

I'm not here to tout the benefits of Mosh, you came here to open it up in your firewall.

  1. Create the following file as /etc/firewalld/services/mosh.xml
  2. firewall-cmd --add-service=mosh --permanent
  3. firewall-cmd --reload

If you tend to have a lot of sessions (not recommended), you can increase the ports, but the default should be fine for most applications.

@martinklepsch
martinklepsch / README.md
Last active February 28, 2022 04:34
A very minimal Emacs configuration to get started with Emacs & Evil-mode

A Starting Point for using Emacs & Evil-mode

(I wrote a bit about why Emacs and Vim on my blog and thought it might be nice to give some starting point for people that want to try it.)

If you just want to play around with Emacs & Evil mode do the following:

  1. mkdir ~/.emacs.d/
  2. copy init.el into ~/.emacs.d/
  3. Download Emacs from http://emacsformacosx.com
@philandstuff
philandstuff / euroclojure2014.org
Last active February 19, 2024 05:12
Euroclojure 2014

EuroClojure 2014, Krakow

Fergal Byrne, Clortex: Machine Intelligence based on Jeff Hawkins’ HTM Theory

  • @fergbyrne
  • HTM = Hierarchical Temporal Memory
  • Slides

big data

  • big data is like teenage sex
    • noone knows how to do it
    • everyone thinks everyone else is doing it
@staltz
staltz / introrx.md
Last active April 24, 2024 19:47
The introduction to Reactive Programming you've been missing