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
// TODO: move 'elements' from array to min-heap | |
final class PriorityQueue<Element: Equatable, Priority> { | |
private var elements = [Element]() | |
private let priorityForElement: (Element) -> Priority | |
private let priorityGreaterThan: (Priority, Priority) -> Bool | |
init( | |
priorityForElement: @escaping (Element) -> Priority, | |
priorityGreaterThan: @escaping (Priority, Priority) -> Bool |
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
# IMPORTANT: GITHUB_TOKEN with "Update ALL user data" permission | |
# | |
# Dependencies: | |
# - curl | |
# - jq | |
# | |
# Run: | |
# GITHUB_TOKEN=<token> GITHUB_USER=<username> ./github_billing.sh | |
# |
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
brew install cpanminus kpcli | |
# https://sourceforge.net/p/kpcli/wiki/Installation%20instructions/ | |
cpanm Crypt::Rijndael Term::ReadKey Sort::Naturally File::KeePass Term::ShellUI Term::ReadLine::Gnu Term::ReadLine::Perl Clipboard Sub::Install Data::Password::passwdqc Data::Password::passwdqc Math::Random::ISAAC Authen::OATH Convert::Base32 |
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 <T> T poll( // can throw | |
long pollIntervalSeconds, // must be bigger than `functionToPoll()` execution time | |
long timeoutSeconds, // global timeout | |
Integer maxConsecutiveExceptionsAllowed, // maximum consecutive times `functionToPoll()` can throw before polling fails | |
Closure<T> functionToPoll, // returns T, can throw | |
Closure<Boolean> successConditionOnFnResult // returns Boolean, condition over `functionToPoll()` result to determine if polling is completed | |
) { | |
def Boolean isDone = false | |
def Boolean isTimeout = false | |
def Integer exceptionCounter = 0 |
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 | |
# Usage: GITHUB_OWNER=<owner> GITHUB_TEAM=<team> clone_all_team_repos.sh | |
# | |
# Dependencies: gh, jq | |
[ -z "$GITHUB_OWNER" ] && echo "Error: GITHUB_OWNER must be defined" && exit 10 | |
[ -z "$GITHUB_TEAM" ] && echo "Error: GITHUB_TEAM must be defined" && exit 20 | |
function cloneIfDoesNotExist() { |
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 | |
# Setup | |
# | |
# ln -sf `pwd`/toggle_sidecar.sh ~/bin/toggle_sidecar.sh | |
# Usage | |
# | |
# toggle_sidecar.sh |
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, Resource} | |
case class Config() | |
case class InputA() | |
case class InputB() | |
case class InputC() | |
case class OutputA() | |
case class OutputB() | |
case class OutputC() |
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
user_id | name | phone | |
---|---|---|---|
annoyingPrefix_001 | Alice | 07782123456 | |
annoyingPrefix_002 | Bob | 07798765432 | |
annoyingPrefix_003 | Carl | 07711928374 |
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
%% Find a number X such that "prepending" 4 to X equals to | |
%% 4 times the number generated by "suffixing" X with 4. | |
%% | |
%% X = X1,...,Xn . 4,X1,...,Xn = 4 * X1,...Xn,4 | |
%% | |
%% :- find( 4, 9000, 11000, N ). | |
%% | |
natural( 0 ). | |
natural( s(X) ) :- natural( X ). |
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 | |
# Usage: ./get_all_gh_secrets.sh "<OWNER>" "100" | |
GITHUB_OWNER=$1 | |
MAX_NUMBER_OF_REPOS=$2 | |
[[ -z "${GITHUB_OWNER}" ]] && echo "Error: GITHUB_OWNER must be passed as first parameter" && exit 10 | |
[[ -z "${MAX_NUMBER_OF_REPOS}" ]] && echo "Error: MAX_NUMBER_OF_REPOS must be passed as second parameter" && exit 20 |
OlderNewer