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.concurrent.ConcurrentLinkedQueue | |
import java.util.concurrent.atomic.AtomicInteger | |
import scala.concurrent.ExecutionContext | |
import scala.util.control.NonFatal | |
import scala.annotation.tailrec | |
object SerializedExecutionContext { | |
def apply(batchSize: Int)(implicit context: ExecutionContext): ExecutionContext = { | |
require(batchSize > 0, s"SerializedExecutionContext.batchSize must be greater than 0 but was $batchSize") | |
new ConcurrentLinkedQueue[Runnable] with Runnable with ExecutionContext { | |
private final val on = new AtomicInteger(0) |
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
#include <regex> | |
#include <string> | |
#include <vector> | |
std::vector<std::string> Split(const std::string& str, const std::string& regex) | |
{ | |
return {std::sregex_token_iterator(str.begin(), str.end(), std::regex(regex), -1), std::sregex_token_iterator()}; | |
} |
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 | |
# Script to switch all programs to a specific sink. Why this isn't easy, i | |
# don't know. | |
# This script takes a single argument, the sink name, index, or alias (defined | |
# below). | |
# To make this work, you will need to: | |
# - In /etc/pulse/default.pa: |
NewerOlder