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 cats.effect.IO | |
import cats.effect.Resource.fromAutoCloseable | |
import org.apache.commons.net.ftp.{FTP, FTPClient} | |
import org.slf4j.{Logger, LoggerFactory} | |
import cats.implicits._ | |
import java.io._ | |
import scala.util.Try | |
/* use: | |
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
def recursiveListFiles(f: File): ArraySeq[File] = { | |
val these = f.listFiles | |
ArraySeq.from(these ++ these.filter(_.isDirectory).flatMap(recursiveListFiles)) | |
} | |
/// | |
import java.io.File | |
def getListOfFiles(dir: String): List[File] = { | |
def go(dir: File): List[File] = dir match { |
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
def _reduce(l: Seq[(String, Json)]): Json = l match { | |
case ::(x, xs) => | |
if (x._2.isNull) { | |
dropNull(Json.fromFields(xs)) | |
} else { | |
val jj = Json.fromJsonObject(JsonObject((x._1, dropNull(x._2)))) | |
xs match { | |
case Nil => jj | |
case _ => dropNull(Json.fromFields(xs)).deepMerge(jj) | |
} |
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
#pragma once | |
#include <atomic> | |
using namespace std; | |
#ifdef _WIN32 | |
#include <intrin.h> | |
#pragma intrinsic(_InterlockedExchange) | |
#define LOCK_TEST_AND_SET(_lock) _InterlockedExchange(&_lock, 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
#pragma once | |
#include "../util/Singleton.h" | |
#include "../util/Time.h" | |
#include <iostream> | |
#include "../threadPool/Spinlock.h" | |
using namespace std; | |
namespace _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
package trackit.helper | |
import java.io.{File, FileInputStream, FileOutputStream} | |
import cats.effect.IO | |
import cats.effect.Resource.fromAutoCloseable | |
import org.apache.commons.compress.archivers.{ArchiveOutputStream, ArchiveStreamFactory} | |
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry | |
import org.apache.commons.compress.utils.IOUtils | |
object ZipHelper { |