Skip to content

Instantly share code, notes, and snippets.

@lisamelton
lisamelton / encode.sh
Last active March 31, 2024 21:13
This is the shell script I use to drive HandBrakeCLI to re-encode video files in a format suitable for playback on Apple TV, Roku 3, iOS, OS X, etc.
#!/bin/bash
# encode.sh
#
# Copyright (c) 2013 Don Melton
#
# This version published on June 7, 2013.
#
# Re-encode video files in a format suitable for playback on Apple TV, Roku 3,
# iOS, OS X, etc.
@viktorklang
viktorklang / Future-retry.scala
Last active July 23, 2023 23:48
Asynchronous retry for Future in Scala
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import akka.pattern.after
import akka.actor.Scheduler
/**
* Given an operation that produces a T, returns a Future containing the result of T, unless an exception is thrown,
* in which case the operation will be retried after _delay_ time, if there are more possible retries, which is configured through
* the _retries_ parameter. If the operation does not succeed and there is no retries left, the resulting Future will contain the last failure.
@vrischmann
vrischmann / .credentials
Last active January 20, 2023 11:57
Running SBT with a Nexus proxy with authentication
realm=Sonatype Nexus Repository Manager
host=nexus.company.com
user=admin
password=admin123
@tonymorris
tonymorris / fuck-you.md
Last active February 26, 2016 01:30
Ignorance has real-world practical effects.

I was just sitting in a doctor surgery 45 minutes ago with an orthopaedic spine surgeon, who is one of the few who has worked out how to use software to his advantage. We were measuring a deformity that the previous surgeon has created. After 20 minutes of drawing lines and measurements all over this DICOM image, the following happened

Access Violation at address 0xGOFUCKYOURSELF

…so now I have to go back in two weeks while he can restart a plan for a difficult corrective surgery.

@postmodern
postmodern / rip_dvd
Last active January 1, 2024 00:22
Script to automate ripping DVDs using Handbrake-CLI and mkvmerge
#!/usr/bin/env bash
#
# Author: postmodern
# Description:
# Rips a DVD to a H.264 MKV file, with chapters and tags. Ignores any
# bad blocks or sectors on the DVD.
# Dependencies:
# * gddrescue
# * handbrake-cli
# * mkvtoolnix
@Changaco
Changaco / btrfs-undelete
Last active April 22, 2024 20:06
btrfs-undelete
#!/bin/bash
# btrfs-undelete
# Copyright (C) 2013 Jörg Walter <info@syntax-k.de>
# This program is free software; you can redistribute it and/or modify it under
# the term of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or any later version.
if [ ! -b "$1" -o -z "$2" -o -z "$3" ]; then
echo "Usage: $0 <dev> <file/dir> <dest>" 1>&2
echo
@philandstuff
philandstuff / codemesh2015.org
Last active November 16, 2015 19:37
Code mesh 2015 notes

Kush, an introduction to schedulers

about me

  • I work for GDS
  • Cabinet Office
  • we started by building GOV.UK
    • replaced older sites like direct gov, business link
  • we’re not just fixing websites
    • we also build and run digital services
    • working with depts across the country
    • eg: register to vote
@3noch
3noch / install-ghcjs-for-stack.hs
Last active August 28, 2016 12:48
Install GHCJS for Stack
#!/usr/bin/env stack
-- stack --install-ghc runghc --package turtle --package wreq
{-# LANGUAGE OverloadedStrings #-}
import qualified Control.Foldl as Fold
import Control.Lens ((^.))
import Control.Monad (when)
import Data.ByteString.Lazy (hPut)
import Data.Maybe (fromMaybe)
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
import Control.Monad.IO.Class
import Control.Monad.Trans.Class
import Prelude hiding (log)
--------------------------------------------------------------------------------
-- The API for cloud files.
class Monad m => MonadCloud m where
saveFile :: Path -> Bytes -> m ()
@CMCDragonkai
CMCDragonkai / short_circuiting_fold.md
Created February 5, 2016 09:10
Haskell: Short Circuiting Fold (Simulating Break in Imperative Languages)

Short Circuiting Fold

This pretty much explains it: http://crypto.stanford.edu/~blynn/haskell/foldl.html here I just review the article.

The rule of thumb is this:

  • if you want short circuiting on foldr, use a lazy on the right combiner
  • if you want short circuiting on foldl, use a lazy on the left combiner