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 React from "react" | |
interface ProgressBarProps { | |
progress?: number | |
size?: number | |
progressColor?: string | |
trackColor?: string | |
strokeWidth?: number | |
showText?: boolean | |
textColor?: string |
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.nio.charset.Charset | |
import java.security.MessageDigest | |
object MD5Hash { | |
def md5(value: String): String = { | |
val Utf8 = Charset.forName("UTF-8") | |
MessageDigest | |
.getInstance("MD5") |
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.time.ZonedDateTime | |
import java.time.format.DateTimeFormatter | |
import cats.implicits._ | |
import io.circe.{ Codec, Decoder, Encoder } | |
// circe codec for serializing ZonedDateTime into JSON | |
object CirceDateTimeUtil { | |
val dateFormatter: DateTimeFormatter = DateTimeFormatter.ISO_ZONED_DATE_TIME |
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.nio.charset.Charset | |
import java.security.MessageDigest | |
def md5(value: String): String = { | |
val Utf8 = Charset.forName("UTF-8") | |
MessageDigest | |
.getInstance("MD5") | |
.digest(value.getBytes(Utf8)) | |
.foldLeft(new StringBuilder) { case (sb, byte) => |
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 scala.concurrent.ExecutionContext | |
import scala.concurrent.duration.DurationInt | |
import scala.util.{ Failure, Success } | |
import akka.Done | |
import akka.actor.{ ActorSystem, CoordinatedShutdown } | |
import akka.http.scaladsl.Http | |
import akka.http.scaladsl.server.Route | |
object AkkaHttpServer { |
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 getPrevAndNext[A](lst: List[A], el: A): Option[(Option[A], A, Option[A])] = { | |
lst match { | |
case Nil => None | |
case x :: Nil if x == el => Some(None, x, None) | |
case _ :: Nil => None | |
case x :: y :: Nil if x == el => Some(None, x, Some(y)) | |
case x :: y :: Nil if y == el => Some(Some(x), y, None) | |
case x :: y :: z :: zs if x == el => Some(None, x, Some(y)) | |
case x :: y :: z :: zs if y == el => Some(Some(x), y, Some(z)) | |
case _ => getPrevAndNext(lst.tail, el) |
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
<ifModule mod_headers.c> | |
Header always set Content-Security-Policy "upgrade-insecure-requests;" | |
</IfModule> |
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 {Component, OnDestroy, OnInit} from '@angular/core'; | |
import {fromEvent, Observable, Subscription} from 'rxjs'; | |
@Component({ | |
selector: 'app-root', | |
templateUrl: './app.component.html', | |
styleUrls: ['./app.component.css'] | |
}) | |
export class AppComponent implements OnInit, OnDestroy { | |
onlineEvent: Observable<Event>; |
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
$ df | |
This will list all mounted devices | |
$ sudo umount /dev/sdc<?> | |
where <?> is a number, look it up. Then, next: | |
$ sudo dd bs=4M if=input.iso of=/dev/sdc<?> | |
where input.iso is the input file, and /dev/sdc<?> is the USB device you're writing to. |
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 javax.net.ssl.HttpsURLConnection; | |
import javax.net.ssl.SSLContext; | |
import javax.net.ssl.TrustManager; | |
import javax.net.ssl.X509TrustManager; | |
import java.security.SecureRandom; | |
import java.security.cert.X509Certificate; | |
public class ConnectionUtil { | |
public static void trustConnection(){ |
NewerOlder