This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var console_buffer = { | |
isBuffering: false, | |
logBuffer: [], | |
preservedConsoleLog: null, | |
start: function() { | |
"use strict"; | |
console.log('INFO: log buffer starting'); // will be lost | |
console_buffer.preservedConsoleLog = console.log; | |
console_buffer.isBuffering = true; | |
console.log = function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This script goes through your Gmail Inbox and finds recent emails where you | |
* were the last respondent. It applies a nice label to them, so you can | |
* see them in Priority Inbox or do something else. | |
* | |
* To remove and ignore an email thread, just remove the unrespondedLabelStr and | |
* apply the ignoreLabelStr. | |
* | |
* This is most effective when paired with a time-based script trigger. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.io.IOException; | |
import java.lang.reflect.InvocationTargetException; | |
import java.lang.reflect.Modifier; | |
import java.util.List; | |
import java.util.Set; | |
import java.util.concurrent.Callable; | |
import java.util.concurrent.TimeUnit; | |
import java.util.logging.Logger; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ffmpeg -ss 00:09:06 -i myfile.flv -c:v libvpx-vp9 -pass 1 -b:v 2000K -threads 8 -speed 4 \ | |
-tile-columns 6 -frame-parallel 1 \ | |
-an -to 02:43:23 -loglevel quiet -f webm /dev/null \ | |
&& ffmpeg -ss 00:09:06 -i myfile.flv -c:v libvpx-vp9 -pass 2 -b:v 2000K -threads 8 -speed 1 \ | |
-tile-columns 6 -frame-parallel 1 -auto-alt-ref 1 -lag-in-frames 25 \ | |
-c:a libvorbis -b:a 128k -to 02:43:23 -loglevel quiet -f webm myfile.webm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Collection; | |
import java.util.Collections; | |
import java.util.HashSet; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.Map.Entry; | |
import java.util.Set; | |
import java.util.SortedMap; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if hash brew 2>/dev/null; then | |
echo "# UPDATING BREW" | |
sudo chown -R $(whoami):admin /usr/local | |
brew update | |
# brew install ffmpeg --with-faac --with-fdk-aac --with-ffplay --with-freetype --with-libass --with-libquvi --with-libssh --with-libvidstab --with-libvorbis --with-libvpx --with-openjpeg --with-openssl --with-opus --with-rtmpdump --with-schroedinger --with-snappy --with-theora --with-tools --with-webp --with-x265 --without-libvo-aacenc --without-qtkit --without-xvid | |
# brew install git wget ffmpeg htop imagemagick jpegoptim optipng sqlite3 python python3 | |
# brew install boost-python --with-python3 | |
# brew install opencv3 --with-contrib --with-cuda --with-ffmpeg --with-tbb --with-qt5 --with-java --with-opengl --with-python3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package info.benjaminhill.klatbot.piconzero | |
import android.content.Context | |
import android.hardware.Sensor | |
import android.hardware.SensorEvent | |
import android.hardware.SensorEventListener | |
import android.hardware.SensorManager | |
import com.google.android.things.pio.Gpio | |
import com.google.android.things.pio.GpioCallback | |
import com.google.android.things.pio.PeripheralManagerService |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.common.collect.ImmutableSet | |
import com.google.common.collect.Sets | |
import com.google.common.reflect.ClassPath | |
import jsat.classifiers.ClassificationModelEvaluation | |
import jsat.classifiers.Classifier | |
import jsat.classifiers.OneVSAll | |
import jsat.classifiers.svm.SupportVectorLearner | |
import jsat.classifiers.trees.DecisionStump | |
import jsat.distributions.kernels.RBFKernel | |
import jsat.exceptions.FailedToFitException |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Save/load any Set<Serializable>, works easily with your simple data class */ | |
inline fun Set<out Serializable>.save(fileName:String="persist_${javaClass.simpleName}.ser.gz") { | |
val tmpPath = Files.createTempFile(fileName, ".tmp") | |
ObjectOutputStream(GZIPOutputStream(Files.newOutputStream(tmpPath, StandardOpenOption.CREATE, StandardOpenOption.WRITE))).use { | |
println("Persisting Set<${javaClass.simpleName}> to $fileName containing ${this.size} entries.") | |
it.writeObject(this) | |
} | |
Files.move(tmpPath, Paths.get(fileName), StandardCopyOption.REPLACE_EXISTING) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Read lines and get counts | |
*/ | |
fun main(args: Array<String>) { | |
val file = File("googlebooks-eng-1M-3gram-20090715-112.csv") | |
val ms = measureTimeMillis { | |
var total = 0 | |
file.inputStream() | |
.bufferedReader() |
OlderNewer