- You can store a price in a floating point variable.
- All currencies are subdivided in 1/100th units (like US dollar/cents, euro/eurocents etc.).
- All currencies are subdivided in decimal units (like dinar/fils)
- All currencies currently in circulation are subdivided in decimal units. (to exclude shillings, pennies) (counter-example: MGA)
- All currencies are subdivided. (counter-examples: KRW, COP, JPY... Or subdivisions can be deprecated.)
- Prices can't have more precision than the smaller sub-unit of the currency. (e.g. gas prices)
- For any currency you can have a price of 1. (ZWL)
- Every country has its own currency. (EUR is the best example, but also Franc CFA, etc.)
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 | |
function intersectJson { | |
echo $* | \ | |
jq -nS ' | |
def intersect: | |
.[0] as $a | | |
.[1] as $b | | |
if ($a | type) == "object" then | |
if ($b | type) == "object" 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
#!/bin/bash | |
# This will output a CSV of all non-archived repositories in the | |
# specified organisation, and whether the CODEOWNERS file is here | |
# or not found. Also exclude forked repositories. A suitable token | |
# must be in the environment variable $GH_TOKEN. | |
ORGA=rgs | |
for repo in $( gh repo list $ORGA --json isArchived,isFork,name --limit 500 \ | |
--jq '.[] | select(.isArchived == false) | select(.isFork == false) | .name' \ |
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
#!perl | |
use 5.18.2; | |
use strict; | |
use warnings; | |
use open ':std', ':utf8'; | |
print " | "; | |
for my $c (0x0915 .. 0x0939) { | |
print chr($c)." | "; | |
} |
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
sub wasted_memory { | |
my ($host, $port) = @_; | |
my @slabstats = `echo stats slabs | nc $host $port`; | |
my %perslab; | |
my $total_malloced = 0; | |
my $total_wasted = 0; | |
for (@slabstats) { | |
if (/STAT total_malloced ([0-9]+)/) { | |
$total_malloced = $1; |
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
" returns a string <branch/XX> where XX corresponds to the git status | |
" (for example "<master/ M>") | |
function CurrentGitStatus() | |
let gitoutput = split(system('git status --porcelain -b '.shellescape(expand('%')).' 2>/dev/null'),'\n') | |
if len(gitoutput) > 0 | |
let b:gitstatus = strpart(get(gitoutput,0,''),3) . '/' . strpart(get(gitoutput,1,' '),0,2) | |
else | |
let b:gitstatus = '' | |
endif | |
endfunc |
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
use strict; | |
use warnings; | |
use File::Slurp; | |
use Image::WordCloud; | |
for my $file (<perl*.pod>) { | |
my $text = `pod2text $file`; | |
my $wc = Image::WordCloud->new(); | |
$wc->words($text); | |
my $gd = $wc->cloud(); | |
$file =~ s/od$/ng/; |