MODE | MEANING | STREAM POSITION | COMMENT |
---|---|---|---|
r | reading | beginning of the file | default |
r+ | reading and writing | beginning of the file | |
w | writing only | Overwrites / creates a new file for writing | |
w+ | writing and reading | Overwrites / creates a new file for reading and writing | |
rb | reading in binary | beginning of the file | |
rb+ | reading and writing binary | ||
wb+ | writing and reading binary | Overwrites / creates a new file for reading and writing | |
a | appending | end of the file if exists | If the file does not exist, it creates a new file for writing. |
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
function query-consul ([string]$customer, [string]$queryString, [int]$context, [switch]$detailed) { | |
$consulURL = "https://consul.foo.net/ui/eu-central-1/kv/customer/$customer" | |
elseif ($detailed) { | |
consul kv get -recurse -detailed customer/$customer | | |
Select-String $queryString -Context 1, $context | |
} | |
else { | |
consul kv get -recurse customer/$customer | | |
Select-String $queryString -Context 1, $context |
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
function backup { | |
cd $kronFolder | |
$today = $today.ToString("yyyy-MM-dd") | |
git add . && git commit -m "$today" && git push | |
} | |
function add-imageFromYesterday { | |
$span = (($today).DayOfWeek -ne "Tuesday") ? 1 : 3 | |
$i = 1 |
NO | DESCRIPTION | VALUE |
---|---|---|
1 | Boolean | False |
2 | None keyword | None |
3 | The number zero | 0 |
4 | An empty string | '' |
5 | An empty list | [] |
6 | An empty tuple | () |
7 | An empty dictionary | {} |
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 main(): | |
try: | |
# DO SOMETHING.... | |
except KeyboardInterrupt: | |
# UPON CTRL+C ASK IF A FILE CONTENTS SHOULD BE DROPPED | |
if input("~~> Interrupted ! Clean-up 'output.txt'? (y/N): ") == "y": | |
# RUN DROPPING FUNCTION IF YES | |
delete_output_content() | |
# AND SAY GOOD BYE | |
sys.exit("bye") |
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
documents = [ | |
"Each in the cell of himself is almost convinced of his freedom", | |
"You know I like that violence that you get around here, that kind of ready steady violence", | |
"Yes that is right punk is dead it is another cheap product for the consumers head", | |
"To be or not to be that is the question" | |
] | |
counts = map(count_words,documents) | |
# OUTPUT IS LAZY OBJECT | |
# <map object at 0x01F2F610> |
The concern is documenting how to ignore files in a git project with a .gitignore
file using so called globbing pattens (aka standard wildcards).
FIELD | COMMENT |
---|---|
checkpoint |
The most recent checkpoint sequence number for the shard. This value is unique across all shards in the data stream. |
checkpointSubSequenceNumber |
When using the Kinesis Producer Library's aggregation feature, this is an extension to checkpoint that tracks individual user records within the Kinesis record. |
leaseCounter |
Used for lease versioning so that workers can detect that their lease has been taken by another worker. |
leaseKey |
A unique identifier for a lease. Each lease is particular to a shard in the data stream and is held by one worker at a time. |
leaseOwner |
The worker that is holding this lease. |
ownerSwitchesSinceCheckpoint |
How many times this lease has changed |
FLAG | MEANING |
---|---|
-e | file exists |
-a | file exists (deprecated, don't use) |
-f | file is a regular file (not a directory or /dev - device file) |
-s | file is not zero size |
-d | file is a directory |
-b | file is a block device (see below) |
-c | file is a character device (see below) |
-p | file is a pipe |