Skip to content

Instantly share code, notes, and snippets.

@markoutso
markoutso / Readme.md
Created Jan 18, 2021 — forked from johannesprinz/Readme.md
Migrating GitLab issues + history to Azure DevOps
View Readme.md

Migrate-GitlabToDevops

Dependencies

You will need an access token from azure devops. Get yours here. This script will need contributor access to the project in question.

How to run

# populate user map in Map-IssueToWorkitem
View GzipBinEncoder.scala
import akka.http.scaladsl.coding.Gzip
import akka.http.scaladsl.model._
object GzipBinEncoder extends Gzip(GzipBinEncoderFilter)
object GzipBinEncoderFilter extends (HttpMessage => Boolean) {
override def apply(message: HttpMessage): Boolean =
message match {
case req: HttpRequest req.entity.contentType.mediaType.isCompressible
case res@HttpResponse(status, _, _, _) =>
@markoutso
markoutso / AwsSigner.java
Last active Jul 12, 2017
Sign Aws requests without external dependencies
View AwsSigner.java
package com.thron.aws;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
View Async.js
function Async(fn, args=[]) {
let stack = [(handler) => fn.apply(undefined, args.concat([handler]))];
let error = (e) => { throw new Error(`An error occured - ${e.message}`); }
function asyncCombine(fn, nfn, nargs) {
return handler => fn((...args) => {
let res = getOrError(args);
return nfn.apply(undefined, nargs.concat([res, handler]));
});
View BiMap.scala
// Similar to http://stackoverflow.com/questions/9850786/is-there-such-a-thing-as-bidirectional-maps-in-scala#9851520
object BiMap {
private[BiMap] trait MethodDistinctor
implicit final object MethodDistinctor extends MethodDistinctor
def apply[X, Y](tuples: (X, Y)*) = new BiMap(tuples.toMap, tuples.map(_.swap).toMap)
def apply[X, Y](m: Map[X, Y]) = new BiMap(m, m.toSeq.map(_.swap).toMap)
}
View Shadower.scala
object Shadower {
case class Term(t: String, start: Int, end: Int)
implicit object SpanTerm extends Span[Term] {
def start(t: Term) = t.start
def end(t: Term) = t.end
}