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
get_crtime() { | |
for target in "${@}"; do | |
inode=$(stat -c '%i' "${target}") | |
fs=$(df --output=source "${target}" | tail -1) | |
crtime=$(sudo debugfs -R 'stat <'"${inode}"'>' "${fs}" 2>/dev/null | | |
grep -oP 'crtime.*--\s*\K.*') | |
printf "%s\t%s\n" "${target}" "${crtime}" | |
done |
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
{ | |
"token": "adsfsadfssfdsdfs" | |
} |
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
## Handy utility scripts. | |
retry_with_timeout () { | |
# Retries the given command until it returns the given value for the given number of times. | |
# Usage retry_with_timeout 'Command to be executed with quotes' <expected value> <number of times to retry> | |
local command_to_try="$1" | |
local expected_value="$2" | |
local expected_timeout="$3" | |
local total_time=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
[ | |
{ | |
"id": "f1", | |
"name": "Restel Site Contact form", | |
"description": "Contact us form in restel site.", | |
"integrations": [ | |
"Mail", | |
"Telegram" | |
] | |
}, |
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
(defn create-matrix | |
"Creates a multi-dimensional vector with dimensions given in dims | |
with the given default value" | |
([default-value & dims] | |
(loop [val default-value remaining dims] | |
(if (empty? remaining) | |
val | |
(recur (vec (repeat (first remaining) val)) | |
(rest remaining))) | |
)) |
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
;; The below macro could have been simple function. Keeping it for reference though | |
(defmacro create-matrix | |
"Clojure macro to create a matrix with any number of dimension" | |
([x & dim] | |
(loop [ex ['->> x] d dim] | |
(if (empty? d) | |
(apply list ex) | |
(recur (into ex [`(repeat ~(first d)) 'vec]) | |
(rest d))) | |
)) |
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.util.function.Function; | |
import java.util.function.Supplier; | |
import static java.util.Objects.requireNonNull; | |
import static java.util.Collections.emptyList; | |
import static java.util.Collections.emptyMap; | |
import static java.util.Collections.emptySet; | |
/** | |
* Class containing the functional utils |
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
/** | |
* Meant to contain the custom utilities related to string. Could be handy in common use cases. | |
**/ | |
public class StringUtils{ | |
/** | |
* Searches the given pattern in the given src string and applies the txr to | |
* the matches. | |
* <br/> | |
* <b>Note:</b> Ex, To convert snake case to camel case make the call, |
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 sun.misc.Signal; | |
import sun.misc.SignalHandler; | |
/** | |
* Demo on making use of SIG_PIPE | |
* | |
*/ | |
public class RespectSigPipe | |
{ | |
static boolean isPipeRecieved = false; |
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
(defn custom-comp | |
"Custom implementation of clojure 'comp'. | |
Accepts a set of functions and returns a composite of | |
those functions. | |
ex, ((custom-comp f1 f2 f3) some-argument) = (f1(f2(f3(some-argument))))" | |
[& fns] | |
(fn [& params] | |
(loop [fn-list fns |
NewerOlder