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
# Every minute, perfect for IP_INFO free tier | |
* * * * * /usr/bin/python3 /PATH_TO_THE_SCRIPT/ipbot.py |
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.alexjlockwood.circlesquare | |
import androidx.compose.animation.animatedFloat | |
import androidx.compose.animation.core.AnimationConstants | |
import androidx.compose.animation.core.LinearEasing | |
import androidx.compose.animation.core.repeatable | |
import androidx.compose.animation.core.tween | |
import androidx.compose.foundation.Canvas | |
import androidx.compose.runtime.Composable |
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
/** Bifunctor IO */ | |
class IO<out E, out A> : | |
`*`<IO<*, *>>, | |
`*-*`<IO<*, *>, A>, | |
`*-*-*`<IO<*, *>, E, A> { | |
fun <B> fmap(f: (A) -> B): IO<Nothing, B> = TODO() | |
fun <B> flatMap(f: (A) -> `*-*`<IO<*, *>, B>): IO<Nothing, B> = TODO() | |
fun <C, D> bimap(fl: (E) -> C, fr: (A) -> D): IO<C, D> = TODO() | |
companion object { |
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 reactor.core.publisher.Mono | |
import java.util.concurrent.Executor | |
fun noTrampolining(): Mono<Int> { | |
var initial = Mono.just(0) | |
(0..5000).forEach { i -> | |
initial = initial.map { i } | |
} | |
return initial |
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 | |
# This command expects two params. | |
# First param is the directory of the png. | |
# Second param is the directory of the webp. | |
# It will traverse the first directory and compare that file with the same webp in the second directory | |
# This script requires to download similar script from http://www.fmwconcepts.com/imagemagick/similar/index.php | |
# and leave it the same directory as this script. This script will be the one leveraging imagemagick | |
pngDir=$1 | |
webpDir=$2 | |
find $1 -name "*.png" | cut -sd / -f 11- | sed 's/\.png$//1'|while read fname; do |
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
#!/usr/bin/env bash | |
set -e | |
build_dir=$(pwd) | |
echo "Curren build dir:" | |
echo $build_dir | |
cd $ANDROID_HOME/emulator | |
echo "Creating sdcard image" |
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
/** | |
* Attempts to start an activity to handle the given intent, excluding activities of this app. | |
* <ul> | |
* <li>If the user has set a default activity (which does not belong in this app's package), it is opened without prompt.</li> | |
* <li>Otherwise, an intent chooser is displayed that excludes activities of this app's package.</li> | |
* </ul> | |
* | |
* @param context context | |
* @param intent intent to open | |
* @param chooserTitle the title that will be displayed for the intent chooser in case one needs to be displayed. |
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 arrow.core.Option | |
class NonZeroInt private constructor(val value: Int) { | |
companion object { | |
operator fun invoke(x: Int): Option<NonZeroInt> = | |
if (x == 0) Option.empty() else Option.just(NonZeroInt(x)) | |
fun get(x: NonZeroInt): Int = x.value | |
} | |
} |
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
when (info) { | |
null -> { | |
return unauthorized() | |
} | |
else -> { | |
val validInfo = validator.validateInfo(info) | |
when (validInfo) { | |
is Either.Right -> { | |
if (!validInfo.b.authorised) { |
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 oogaday.commons.enums | |
enum class StatusCode(val code: Int) { | |
Continue(100), | |
SwitchingProtocols(101), | |
Processing(102), | |
OK(200), | |
Created(201), | |
Accepted(202), |
NewerOlder