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
Source(List("/", "/docs")) | |
.map(theUri => HttpRequest(uri = theUri)) | |
.via(Http().outgoingConnection("akka.io").async) | |
.mapAsyncUnordered(2)(r => r.entity.toStrict(2 seconds)) | |
.map(e => e.data.utf8String) | |
.fold(List[String]())(_ :+ _) | |
.runWith(Sink.head) | |
.onComplete(logger.info("{}", _)) | |
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
type SomeResource struct { | |
counter int | |
} | |
func (sr *SomeResource) incCounter(rw http.ResponseWriter, r *http.Request) { | |
sr.counter++ | |
} | |
func (sr *SomeResource) getCounter(rw http.ResponseWriter, r *http.Request) { | |
v := strconv.Itoa(sr.counter) |
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
{"attributes":"\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!DOCTYPE ObjectMetadata SYSTEM \"/SysConfig/Classify/FTStories/classify.dtd\"\u003e\u003cObjectMetadata\u003e\n \u003cEditorialDisplayIndexing\u003e\n \u003cDILeadCompanies/\u003e\n \u003cDITemporaryCompanies\u003e\n \u003cDITemporaryCompany\u003e\n \u003cDICoTempCode/\u003e\n \u003cDICoTempDescriptor/\u003e\n \u003cDICoTickerCode/\u003e\n \u003c/DITemporaryCompany\u003e\n \u003c/DITemporaryCompanies\u003e\n \u003cDIFTSEGlobalClassifications/\u003e\n \u003cDIStockExchangeIndices/\u003e\n \u003cDIHotTopics/\u003e\n \u003cDIHeadlineCopy\u003eBarclays shares climb as Exane sees good news in history\u003c/DIHeadlineCopy\u003e\n \u003cDIBylineCopy\u003eBryce Elder\u003c/DIBylineCopy\u003e\n \u003cDIFTNPSections/\u003e\n \n \n \u003cDIFirstParCopy\u003eUK stocks slip to their worst weekly perfo |
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 main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
"net/http/httputil" | |
"github.com/gorilla/mux" | |
) |
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
Intel i7 5820K 33126 MIPS ~ 2^15 MIPS (million instructions per second) = 2^35 IPS | |
Intel i7 6700K 25475 MIPS ~ roughly rounding up kind-of gives you the same |
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 main | |
import ( | |
"fmt" | |
"time" | |
) | |
func main() { | |
q := make(chan string, 1) |
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
Don't let me Google that for you | |
Just ctrl-f this file | |
# The Git reference: | |
git checkout --help | |
# Pushing | |
# Recommended pushing method | |
git push <remote> sourceBranch | |
git push origin master |
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 main | |
import ( | |
"fmt" | |
"math/rand" | |
"os" | |
"time" | |
"golang.org/x/crypto/scrypt" | |
) |
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 com.hiya.h4b.cpas.service | |
import java.time.Instant | |
import java.time.Instant.now | |
import akka.http.scaladsl.model.StatusCode | |
import akka.http.scaladsl.model.StatusCodes.{Created, NotFound, OK} | |
object Typeclasses extends App { |
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
# Appends a new line with a - to every frame of movie subtitles to shift | |
# the overall position up when the tv cuts down the bottom. | |
# | |
# ruby subtitles-shift-up.rb Titanic.srt | |
# or | |
# ruby subtitles-shift-up.rb Titanic.srt UTF-8 | |
# | |
# result: Titanic-shifted.srt | |
def addEmptyLine(inFile, outFile) |