type StringBool = "true"|"false";
interface AnyNumber { prev?: any, isZero: StringBool };
interface PositiveNumber { prev: any, isZero: "false" };
type IsZero<TNumber extends AnyNumber> = TNumber["isZero"];
type Next<TNumber extends AnyNumber> = { prev: TNumber, isZero: "false" };
type Prev<TNumber extends PositiveNumber> = TNumber["prev"];
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
### Keybase proof | |
I hereby claim: | |
* I am bhaskarkc on github. | |
* I am containerlife (https://keybase.io/containerlife) on keybase. | |
* I have a public key ASBWcg-W8kMByeVATdF9M9IMWZXenoe-kfng8lJesnQK6Qo | |
To claim this, I am signing this 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
-------------------------------------------------------------------------------- | |
THE INSANE POWER OF VIM'S GLOBAL COMMAND | |
Joe Ellis | |
Last edited: Sun 10 Oct 2021 21:18:45 BST | |
-------------------------------------------------------------------------------- | |
If you're an advanced Vim user, you've probably already used the `:global` | |
command. It allows you to to execute an Ex command on a set of lines where a |
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
type scanStatus int | |
const ( | |
Pending scanStatus = iota | |
Processing | |
) | |
// String returns respective string value of scanStatus enum. | |
// implements Stringer interface | |
func (s scanStatus) String() 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
class Singleton: | |
def __init__(self, cls): | |
self._cls = cls | |
def Instance(self): | |
try: | |
return self._instance | |
except AttributeError: | |
self._instance = self._cls() | |
return self._instance |
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
<?php | |
/** | |
* Returns the sum of all multiples of 3 or 5 | |
* | |
* @param int $number | |
* @return int | |
*/ | |
function multiple_of_3_or_5($number) | |
{ |
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
<?php | |
/* | |
Let's write a simple markdown parser function that will take in a single line of markdown and be translated into the appropriate HTML. To keep it simple, we'll support only one feature of markdown in atx syntax: headers. | |
Headers are designated by (1-6) hashes followed by a space, followed by text. The number of hashes determines the header level of the HTML output. | |
Examples | |
# Header will become <h1>Header</h1> | |
## Header will become <h2>Header</h2> |
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
docker_container_ip() { | |
containerName=$1 | |
[[ -z "$1" ]] && { | |
echo "Please pass container name!" | |
exit 1 | |
} | |
# Default docker network | |
networkName="mysql-db" | |
if [[ -n "$2" ]]; then |
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
# file location: /usr/lib/systemd/system/thinkfan.service | |
[Unit] | |
Description=simple and lightweight fan control program | |
Wants=lm_sensors.service | |
After=lm_sensors.service | |
[Service] | |
Type=forking | |
ExecStart=/home/cybapunkz/.local/bin/thinkfan $THINKFAN_ARGS |
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
# Basic binds | |
# vim: ft=conf | |
super + d | |
dmenu_run -fn 'Iosevka' | |
super + shift + a | |
$TERMINAL -e pulsemixer; pkill -RTMIN+12 blocks | |
super + shift + c | |
camtoggle | |
super + grave |
NewerOlder