A collection of small, fast-forward recipes for achieving common common Dev-Ops goals and simplifying daily work with Linux, Bash, Pandoc and Nginx.

Deep work

Qutebrowser

Configuration file of ~/.config/qutebrowser/config.py:

c.content.host_blocking.lists = [
  'https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/social/hosts'
]

config.bind(',h', 'config-cycle -t -p content.host_blocking.enabled')

c.url.start_pages = ["about:blank"]

c.url.searchengines = {
  "DEFAULT": "https://google.com/search?q={}"
}

Firefox

Clean browsing history and cache

Press: [Ctrl]+[Shift]+[Del].

Block obtrusive content

To block hot network questions, go to: uBlock Origin -> Open the dashboard -> Add a rule ###hot-network-questions -> click "Apply changes".

More useful uBlock Origin filters:

! StackExchange Network
###hot-network-questions

! 4/27/2018, 1:08:35 PM https://medium.com/
! Medium Corporation subscription nag footer
##.js-stickyFooter

! 6/21/2018, 10:55:40 AM https://www.youtube.com/
! YouTube video related content
www.youtube.com###related

! 6/26/2018, 11:39:21 AM https://www.youtube.com/
! YouTube welcome page recommended rubbish
www.youtube.com###dismissable

You might find a network-wide ad-blocker useful. In such a case, see Why You Need a Network-Wide Ad-Blocker for the Pi-hole package.

Browsing

Browse tabs as a tree: https://github.com/piroor/treestyletab.

  • To toggle the sidebar, press [F1].

about:config settings for privacy and performance:

Fetch Web information through your terminal

Wikipedia

Search Wikipedia from terminal: wikit <query>; install with npm install -g wikit.

Google

Google quickly from command line

sudo add-apt-repository ppa:twodopeshaggy/jarun
sudo apt-get update
sudo apt-get install googler

$ googler <query>

Check your external IP

BLAZINGLY FAST, directly from your terminal emulator. We are ultra-grateful to Tomasz "Sztylet" for every minute we saved thanks to this.

$ curl ifconfig.co

Check weather via console

curl wttr.in/warsaw

Instant URLs

  • Google Feeling Lucky: http://google.com/search?btnI=1&q=<query>
  • Encyclopedia Britannica:
    • britannica.com/topic/<query>
    • https://www.britannica.com/search?query=<query>

Web browsers

Start in a private window

  • Firefox: firefox --private-window
  • Opera: opera --private

Smartphone SSH access

Connect to your phone via terminal with Termux:

ssh any_user_name@phone_ip -p 8022

Documentation

Sources of graphics

Repositories of free-to-use-commercially branding content

Icons

Open-source icons:

Public-domain icons:

Custom logos in seconds:

Photographs

  • Unsplash.com

Drawing schematics

Retain and manage knowledge

I developed my own system where I’d have a text file on my desktop with a file name of let’s say 2016-12 for December 2016. Then I would jot down everything worth saving in that file. (...) It’s productive because there’s no complex application to get situated with. You open up a text editor, jot down your note and save it. That’s it. There’s no thought process required for figuring out tags or context.

-- Nick Janetakis, Plain Text and Google keep Is a Killer Combo for Notes and Organization

Text editing

Markdown

See atom.io, with a plug-in: document-outline.

Or vim with plug-in Voom.

Or GhostWriter which even played a linked animated GIF correctly.

To convert from OneNote to Markdown you can follow this tip.

Vim

Save with sudo

:w !sudo tee %

About it

Join lines

To remove unneeded newlines in Vim, press J or gJ (to avoid adding spaces instead). To remove only from a part of the text, select the text with v or V and then press J or gJ respectively.

source: here

If afterwards multiple consecutive spaces occur, you can use the RegEx pattern of s/ \{2,}/ /g to remove them, possibly selecting a specific block of text to operate on beforehand. This tip came from mikerobi.

Insert 8 spaces quickly

<C-o>:norm 8i <CR>

<C-o> stands for [Control]+[o] - commanding without leaving insert mode.

Retab a file
:set expandtab
:retab

To change the number of spaces substituted for a tab, issue: :set shiftwidth=<number> with <number> of 4 for example.

Use 4 spaces for TAB in ViM

Put the below into .vimrc.

filetype plugin indent on
" show existing tab with 4 spaces width
set tabstop=4
" when indenting with '>', use 4 spaces width
set shiftwidth=4
" On pressing tab, insert 4 spaces
set expandtab

To quickly type the above to a file with cat, use cat >> ~/.vimrc << EOF.

.vimrc collected personal configuration
filetype plugin indent on
" show existing tab with 4 spaces width
set tabstop=4
" when indenting with '>', use 4 spaces width
set shiftwidth=4
" On pressing tab, insert 4 spaces
set expandtab

" Assign Paste Mode toggle to [F3].
set pastetoggle=<F3>

" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
  au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif

Managing references

Track references locally with Zotero: To install Zotero, you can use the instructions herein.

Preview Markdown in console

Isssue: pip install mdv --user, mdv README.md.

Converting to PDF

Pass your defaults.yaml file containing your defaults as the last argument like so:

pandoc -f markdown -s your-input-file.md defaults.yaml

Metadata definitions seen first are kept and left unchanged, even if conflicting data is parsed at a later point.

Source: issues

When a value is set multiple times in the same document, the
earlier one takes priority.

-- John MacFarlane

Record your desktop

Byzantz looks promising, mentioned in this answer.

Install:

sudo add-apt-repository ppa:fossfreedom/byzanz
sudo apt-get update && sudo apt-get install byzanz

Run:

# Install Cairo (One of those may suffice):
sudo apt install libcairo2-dev libcairo2-doc
libcairomm-dev libcairo2

# Install GTK+ 3.0:
sudo apt-get install build-essential libgtk-3-dev

# Run install:
./autogen.sh

Viewing EPUB in Linux

Using fbreader for that - faster and lighter than popular alternatives like Okular or Calibre. May be more buggy, some warn.

And it is buggy - scrollbar behavior is inconsistent. The icons are bad style. But the e-book is displayed correctly.

Publishing documentation

See ReadTheDocs.io.

Here is a step by step guide on how to install Read the Docs. It will get you to a point of having a local running instance.

-- Installing ReadTheDocs locally, Installation

Linux

Development

Testing

To test software agains Bash I/O, you can use bats.

Consult the BATS file format syntax: man 7 bats. In general, chapter 7 of the Man pages includes "macro packages and conventions".

Test scenarios
Test HTTP service availability

To test connectivity with a container, call the following script:

#!/usr/bin/env bash

# Test if visiting the my.service.com page returns a `success` HTTP response code.

printf "Is the GitLab server accessible via HTTPS?: "

res=`curl -w "%{http_code}\n" "https://my.service.com" -s -o /dev/null -L`;

if [ "$res" -eq 200 ] ; then echo "true"; else echo "false"; fi

Packaging

Cleanly install a Linux package you prepared: If your package has no make uninstall target, issue sudo checkinstall.

Ensure root privileges before make install:

install:
    @bash -c "if [[ $EUID -ne 0 ]] ; then \
        echo \"This script must be run as root.\" ; \
        exit 1; \
    else \
        cp -r . /usr/local/my_package ; \
    fi"

Version tracking with Git

Track an existing directory with GitLab online:

cd existing_folder
git init
git remote add origin <repository_url>
git add .
git commit -m "Initial commit"
git push -u origin master
Remove a remote Git branch

git push origin --delete <branch_name>

Operations

List users on the system: cut -d: -f1 /etc/passwd.

Synchronize directories: To make the destination a strict, mirror copy of the source, deleting any extra files it may have: rsync -av --delete /home/joe/from-dir /media/backup/to-dir.

Install a package from source

The standard, UNIX-wide universal way to install a TGZ package after [1]:

  1. ./configure,
  2. make,
  3. make install.

If you need to deploy the package over SSH, deployr might be helpful.

Create a clean testing environment

Quickly set-up a clean Linux environment in a container.

  1. docker pull ubuntu:xenial or docker pull amd64/node,
  • docker run --name testing_ground --rm -it ubuntu:xenial bash for a clean Ubuntu, or
  • docker run --name testing_ground --rm -it amd64/node bash for a clean NodeJS container,
  1. Now we can execute commands inside the container. WARNING: All session data will be lost when upon exiting the container.

Copy file contents to clipboard from the terminal

xclip <file_name> -selection clipboard

Save clipboard contents as a file:

xclip -selection clipboard -o > <file_name>

Print directory content as a list of configuration values

grep "" <directory> -s

Help

Try apropos first, then man or info [2].

Zeal Docs is a good program to have on hand in case offline operation becomes necessary for a while.

Examples of some Linux commands: curl cheat.sh [3].

If you feel you have to refer to online resources to get help, you can make that experience less engaging by using qutebrowser. It allows you to browse the Web using solely Vim-style keyboard controls.

One of the things that can really make or break a project for me is how its developers behave towards the users. The developer of this project is a really upstanding, responsive, kind human being. I think his project deserves all the attention it can get.

I have used qutebrowser as my primary browser on Linux for years. I have no complaints. In fact, qutebrowser runs smoothly on some of my older machines where Firefox struggles to run.

-- YC News

Replace a configuration line

Replace a line setting with another: awk '/line_string_to_seek_to/{gsub(/previous_value/, "new_value")};{print}' file_name. For example, to substitute my.satpack.eu for localhost, we do the following:

awk '/ws = new WebSocket/{gsub(/8443/, "443")gsub(/localhost/, "my.satpack.eu")};{print}' private/main.js > private/main.js.new && mv private/main.js.new private/main.js

Nginx: redirect subdomain to a port quickly

server {
    listen 80; # Port to redirect
    server_name docker.giss.pl; # Queried address

    location / {
        proxy_pass https://localhost:5001; # Address to point to
    }
}

See here.

Edit the file /etc/nginx/sites-enabled/default.

Upgrade your shell from Bash to Z-Shell

Install zsh. Then install Oh-My-Zsh from ohmyz.sh. Then, import settings from Bash to Zsh by moving your common settings to the file .profile and including them as follows from here:

  • File .bashrc: source ~/.profile,
  • File .zshrc: [[ -e ~/.profile ]] && emulate sh -c 'source ~/.profile'.

Install a package in Ubuntu

Use apt instead of apt-get: Apt is a modern overlay of apt-get and apt-cache. See It's FOSS.

Run a command in the background

screen -S <mnemonic> <command>

The mnemonic helps in the process of retrieving the particular screen.

Check version of package in Ubuntu

apt list <package_name>

Blank the screen

#!/bin/bash
sleep 1; xset dpms force off

Then you can set a shortcut in Gnome3 application "keyboard" (gnome-control-center keyboard) to run that script when you push [CTRL+ALT+Q].

List groups in the system

cut -d: -f1 /etc/group

Add user to group sudo

# > usermod -a -G sudo <user>

Synchronize two directories

rsync -rtvu --delete source_folder/ destination_folder/

Explained here.

Do a quick desktop calculation

gnome-calculator -s "expression"

Generate a random password

head /dev/urandom | tr -dc A-Za-z0-9 | head -c 13 ; echo [4]

Bash scripting

Basic script architecture

References:

#!/usr/bin/env bash

log() {
    mkdir log
    exec 1>>log/output.log
    exec 2>>log/errors.log
}

location=$(readlink -f "$0")
install_dir=$(readlink -f $(dirname $location))

# set -o xtrace

do_stuff() {
    echo Doing stuff...
}

list_functions() {

    # List all functions found in this file.

    # Based on the ideas of Glenn Jackman,
    # https://stackoverflow.com
    #         /a/5868245

    typeset -f | awk '/ \(\) $/ && !/^main / {print $1}'

}

ensure_root() {
    # Request root privileges.
    if [[ $EUID -ne 0 ]] ; then
        echo "This script must be run as root." ;
        exit 1;
    else
        proceed
    fi
}

show_help() {
    printf "Usage: $0 <function_to_call>\n"
    echo "= Available functions:"

    list_functions
}

main() {
  show_help
}

check_command() {
  # Verify that the command exists and is a function,
  # Credit: that other guy, Stack Overflow

  # Check if the function exists (bash specific)
  if declare -f "$1" > /dev/null
  then
    # call arguments verbatim
    "$@"
  else
    # Show a helpful error
    echo "'$1' is not a known function name" >&2
    exit 1
  fi
}

call_directly() {
    if [[ $# -gt 0 ]] ; then
        "$@"
    else
        return 1
    fi
}

(call_directly "$@" && exit 0) || main "$@"
Enable command tab completion

To enable tab-completion, refer to Kyle Bak:

# Bash
complete -F <completion_function> notes
# Zsh
compctl -K <completion_function> notes
Run function in a sub-shell by default

To spawn the function in a subshell rather than execute it in the current environment, replace the usual code-block braces with normal braces [5]:

Turning this:

function name () {
  # Code here
}

into this:

function name () (
  # Code here
)
Change a string in a file

Edit file in place - filter: sed -i 's/STRING_TO_REPLACE/STRING_TO_REPLACE_IT/g' filename

Redirect stdout to a file

do_something &> some_file

Design complex text pipelines in a fast feedback loop

up is the Ultimate Plumber, a tool for writing Linux pipes in a terminal-based UI interactively, with instant live preview of command results.

-- up

Find duplicate files

Tool named duff reports on duplicate files, via a SHA1 hash of the contents, recursively. For alternatives, see [6].

Change host name

  1. Edit /etc/hostname file to match needs,
  2. Run /etc/init.d/hostname.sh start to apply change to the running system.
  3. Edit /etc/hosts to match your new host name (optional, for cleanliness).

source

Internet services

Set up an external domain name for a host: NoIP.

Review listening interfaces

netstat -a / nmap localhost

Or:

sudo lsof -i
sudo netstat -lptu
sudo netstat -tulpn
Find live hosts on your subnet

nmap -sP 192.168.1.1/24

Edit the SSH welcome message

Edit the file /etc/motd. More on this topic is here.

Change the message into a dynamic one: read in the above article under the section "How to then?".

Allow a port in Ubuntu

For example, for port 444 issue: ufw allow 444/tcp.

Warning: UFW may not run instead, but in series with iptables. To configure iptables, follow simple instructions here.

To save the rules, issue sudo service iptables save.

Resume file download

wget -c <url> --output-document=<partially_downloaded_file_name>

Download a large file over a freezing connection

wget -c --tries=0 --read-timeout=4 [URL]

-- Pablo Zubieta

Docker

Review running containers

Docker built-in method

docker ps -a view is unclear due to long lines that do not wrap in a uniform manner.

Vertical listing

To display all containers vertically, call the following script:

#!/usr/bin/env bash

export FORMAT="ID\t{{.ID}}\nNAME\t{{.Names}}\nIMAGE\t{{.Image}}\nPORTS\t{{.Ports}}\nCOMMAND\t{{.Command}}\nCREATED\t{{.CreatedAt}}\nSTATUS\t{{.Status}}\n"

docker ps --format="$FORMAT"

Third-party terminal-based dashboard

An alternative is the dry monitoring tool.

Clean up

Remove all stopped Docker containers: docker ps -a -q | xargs docker rm -v.

Remove all unlabeled images not attach to any running container: docker images -f dangling=true -q | xargs docker rmi.

-- David Maze

JavaScript

Preview JSON data

View online

JSON Editor Online displays your JSON side-by-side in a readable, hierarchical format.

View in terminal

Pipe your JSON data into the command python -m jsontool.

Tweak code performance

Tweak software performance using "wormholes": see DZone

Authenticate clients to a server

A less-well-known but nevertheless useful feature of SSL is that it can be used to authenticate clients to a server, as well as simply providing an encrypted communication channel.

-- Laurence Withers

Examples of how a client can be authenticated to a server include:

  1. SQRL by Gibson Research Corporation,
  2. SSL, see

Serve file content via HTTP

Example worked from here.

Idea is to load a JSON and reload it every n seconds, realized here.

Update the file periodically

Periodically update file:

dmesg | tail | sudo tee test.html

Repeat a command automatically: watch -n <seconds> <command>.

Refresh log file every 3 seconds:

watch -n 3 'dmesg | tail | sudo tee test.html'

Code to run to demo:

sudo watch -n 1 ./rep.sh

Fair use

ISC License

Licencja ISC – licencja wolnego oprogramowania autorstwa Internet Systems Consortium. Zezwala na korzystanie z programu i jego kodu źródłowego w dowolnym celu, pod warunkiem zachowania informacji o autorze wraz z treścią licencji. Ponadto autor nie udziela żadnych gwarancji związanych z programem. Tym samym licencja ISC odpowiada warunkom korzystania na jakie zezwalają licencje 2-klauzulowa BSD i MIT, jest jednak od nich krótsza i napisana prostszym językiem, z pominięciem słownictwa uznanego przez Konwencję berneńską za zbędne.

Z licencji ISC korzysta między innymi projekt OpenBSD[1].

See Wikipedia

License content:

Copyright © 2004-2013 by Internet Systems Consortium, Inc. (“ISC”)

Copyright © 1995-2003 by Internet Software Consortium
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED “AS IS” AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Communication

Find a person's e-mail

If they have a GitHub repository, you can try the link below, replacing xxxxxx with their username: https://api.github.com/users/xxxxxxx/events/public.

In the received response, search for the string "email".

The tip comes from here.

Send an e-mail message through your terminal

  1. Place your e-mail configuration in the file ~/.mailrc,
  2. Send your e-mail using the command: mail <addressee> < <message_file.eml>.

Pocket software engineer's lexicon

  • nonce - (ang.) identyfikator jednorazowy, (przymiotnik) okazjonalizm

Satellite communication

satbeams.com - a catalog of satellites

LNB - Low noise block

Natural constraints

Euler's identity

"The most beautiful equation in mathematics":

$$e^{i*pi} + 1 = 0$$

"like a Shakespearean sonnet that captures the very essence of love, or a painting that brings out the beauty of the human form that is far more than just skin deep, Euler's equation reaches down into the very depths of existence

-- Keith Devlin, Stanford, see Wikipedia

The Dirac Delta equation

$$(i * delta - m) * psi = 0$$

Mind

Retype instead of copy-pasting

I was able to quickly remember what I retyped before. Speeded up my work.

Develop better as a programmer

Take decisions fast and assume responsibility for yourself, your team and your client

Stop worrying about future decisions and dive in.
Make practice fun by treating new skills like toys.
Find time to code by only making tiny commitments the way you would with sites like Facebook, YouTube, or Wikipedia.
Slow down, take smaller steps, and you’ll learn faster.

More specifically:

  1. Don’t Let Future Decisions Stop You from Progressing Now,
  2. Don’t Let Confidence Trick You into Forgetting Things,
  3. Approach Practice with the Right Mindset,
  4. Find Time to Code Using the Facebook Trick,
  5. Think Slower and You’ll Learn Faster,
  6. Write Complex Code in Plain Language First.

-- Yaphi Berhanu, Six Simple Mind Tricks to Help You Learn JavaScript Faster

Ignitory question

Am I inventing things to do to avoid the important?

-- Tim Ferriss, "The 4-Hour Work Week"

Specify clear goals

Remember the SMART rule - a goal should basically be:

  1. Specific,
  2. Measurable,
  3. Ambitious,
  4. Relevant, and
  5. Time-bound.

Make growth a daily routine

  1. Start the day with 2-3 hours of deep work (see "Deep Work" by Cal Newport),
  2. Postpone checking your e-mail until near the end of the day.
  3. Conclude the day with a review of the day (see "Deep Work") and a quick skim through the headlines on the Hacker News (optional; see "4-Hour Work Week" - news are not at all necessary to thrive, let alone to survive).

Pragmatic Programmer's Highlights

  1. Care About Your Craft Why spend your life developing software unless you care about doing it well?,
  2. Think! About Your Work Turn off the autopilot and take control. Constantly critique and appraise your work.,
  3. Provide Options, Don't Make Lame Excuses Instead of excuses, provide options. Don't say it can't be done; explain what can be done.,
  4. Don't Live with Broken Windows Fix bad designs, wrong decisions, and poor code when you see them.,
  5. Be a Catalyst for Change You can't force change on people. Instead, show them how the future might be and help them participate in creating it.,
  6. Remember the Big Picture Don't get so engrossed in the details that you forget to check what's happening around you.,
  7. Make Quality a Requirements Issue Involve your users in determining the project's real quality requirements.,
  8. Invest Regularly in Your Knowledge Portfolio Make learning a habit.,
  9. Critically Analyze What You Read and Hear Don't be swayed by vendors, media hype, or dogma. Analyze information in terms of you and your project.,
  10. It's Both What You Say and the Way You Say It There's no point in having great ideas if you don't communicate them effectively.,
  11. DRY – Don't Repeat Yourself Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.,
  12. Make It Easy to Reuse If it's easy to reuse, people will. Create an environment that supports reuse.
  13. Eliminate Effects Between Unrelated Things Design components that are self-contained. independent, and have a single, well-defined purpose.
  14. There Are No Final Decisions No decision is cast in stone. Instead, consider each as being written in the sand at the beach, and plan for change.
  15. Use Tracer Bullets to Find the Target Tracer bullets let you home in on your target by trying things and seeing how close they land.
  16. Prototype to Learn Prototyping is a learning experience. Its value lies not in the code you produce, but in the lessons you learn.
  17. Program Close to the Problem Domain Design and code in your user's language.
  18. Estimate to Avoid Surprises Estimate before you start. You'll spot potential problems up front.
  19. Iterate the Schedule with the Code Use experience you gain as you implement to refine the project time scales.
  20. Keep Knowledge in Plain Text Plain text won't become obsolete. It helps leverage your work and simplifies debugging and testing.
  21. Use the Power of Command Shells Use the shell when graphical user interfaces don't cut it.
  22. Use a Single Editor Well The editor should be an extension of your hand; make sure your editor is configurable, extensible, and programmable.
  23. Always Use Source Code Control Source code control is a time machine for your work – you can go back.
  24. Fix the Problem, Not the Blame It doesn't really matter whether the bug is your fault or someone else's – it is still your problem, and it still needs to be fixed.
  25. Don't Panic When Debugging Take a deep breath and THINK! about what could be causing the bug.
  26. "select" Isn't Broken. It is rare to find a bug in the OS or the compiler, or even a third-party product or library. The bug is most likely in the application.
  27. Don't Assume It – Prove It Prove your assumptions in the actual environment – with real data and boundary conditions.
  28. Learn a Text Manipulation Language. You spend a large part of each day working with text. Why not have the computer do some of it for you?
  29. Write Code That Writes Code Code generators increase your productivity and help avoid duplication.
  30. You Can't Write Perfect Software Software can't be perfect. Protect your code and users from the inevitable errors.
  31. Design with Contracts Use contracts to document and verify that code does no more and no less than it claims to do.
  32. Crash Early A dead program normally does a lot less damage than a crippled one.
  33. Use Assertions to Prevent the Impossible Assertions validate your assumptions. Use them to protect your code from an uncertain world.
  34. Use Exceptions for Exceptional Problems Exceptions can suffer from all the readability and maintainability problems of classic spaghetti code. Reserve exceptions for exceptional things.
  35. Finish What You Start Where possible, the routine or object that allocates a resource should be responsible for deallocating it.
  36. Minimize Coupling Between Modules Avoid coupling by writing "shy" code and applying the Law of Demeter.
  37. Configure, Don't Integrate Implement technology choices for an application as configuration options, not through integration or engineering.
  38. Put Abstractions in Code, Details in Metadata Program for the general case, and put the specifics outside the compiled code base.
  39. Analyze Workflow to Improve Concurrency Exploit concurrency in your user's workflow.
  40. Design Using Services Design in terms of services – independent, concurrent objects behind well-defined, consistent interfaces.
  41. Always Design for Concurrency Allow for concurrency, and you'll design cleaner interfaces with fewer assumptions.
  42. Separate Views from Models Gain flexibility at low cost by designing your application in terms of models and views.
  43. Use Blackboards to Coordinate Workflow Use blackboards to coordinate disparate facts and agents, while maintaining independence and isolation among participants.
  44. Don't Program by Coincidence Rely only on reliable things. Beware of accidental complexity, and don't confuse a happy coincidence with a purposeful plan.
  45. Estimate the Order of Your Algorithms Get a feel for how long things are likely to take before you write code.
  46. Test Your Estimates Mathematical analysis of algorithms doesn't tell you everything. Try timing your code in its target environment.
  47. Refactor Early, Refactor Often Just as you might weed and rearrange a garden, rewrite, rework, and re-architect code when it needs it. Fix the root of the problem.
  48. Design to Test Start thinking about testing before you write a line of code.
  49. Test Your Software, or Your Users Will Test ruthlessly. Don't make your users find bugs for you.
  50. Don't Use Wizard Code You Don't Understand Wizards can generate reams of code. Make sure you understand all of it before you incorporate it into your project.
  51. Don't Gather Requirements – Dig for Them Requirements rarely lie on the surface. They're buried deep beneath layers of assumptions, misconceptions, and politics.
  52. Work With a User to Think Like a User It's the best way to gain insight into how the system will really be used.
  53. Abstractions Live Longer than Details Invest in the abstraction, not the implementation. Abstractions can survive the barrage of changes from different implementations and new technologies.
  54. Use a Project Glossary Create and maintain a single source of all the specific terms and vocabulary for a project.
  55. Don't Think Outside the Box – Find the Box When faced with an impossible problem, identify the real constraints. Ask yourself: "Does it have to be done this way? Does it have to be done at all?"
  56. Start When You're Ready. You've been building experience all your life. Don't ignore niggling doubts.
  57. Some Things Are Better Done than Described Don't fall into the specification spiral – at some point you need to start coding.
  58. Don't Be a Slave to Formal Methods. Don't blindly adopt any technique without putting it into the context of your development practices and capabilities.
  59. Costly Tools Don't Produce Better Designs Beware of vendor hype, industry dogma, and the aura of the price tag. Judge tools on their merits.
  60. Organize Teams Around Functionality Don't separate designers from coders, testers from data modelers. Build teams the way you build code.
  61. Don't Use Manual Procedures A shell script or batch file will execute the same instructions, in the same order, time after time.
  62. Test Early. Test Often. Test Automatically Tests that run with every build are much more effective than test plans that sit on a shelf.
  63. Coding Ain't Done 'Til All the Tests Run 'Nuff said.
  64. Use Saboteurs to Test Your Testing Introduce bugs on purpose in a separate copy of the source to verify that testing will catch them.
  65. Test State Coverage, Not Code Coverage Identify and test significant program states. Just testing lines of code isn't enough.
  66. Find Bugs Once Once a human tester finds a bug, it should be the last time a human tester finds that bug. Automatic tests should check for it from then on.
  67. English is Just a Programming Language Write documents as you would write code: honor the DRY principle, use metadata, MVC, automatic generation, and so on.
  68. Build Documentation In, Don't Bolt It On Documentation created separately from code is less likely to be correct and up to date.
  69. Gently Exceed Your Users' Expectations Come to understand your users' expectations, then deliver just that little bit more.
  70. Sign Your Work Craftsmen of an earlier age were proud to sign their work. You should be, too.

-- The Pragmatic Programmer Quick Reference Guide

From the book "The Pragmatic Programmer", copy here

Big hacks

Competitive Programming

Levels

  1. ICPC
  2. Regional ICPC,
  3. Topcoder,
  4. Codechef,
  5. SPOJ

Topics:

  1. Graph algorithms,
  2. Dynamic programming,
  3. Searching and sorting,
  4. Number theory and other mathematical concepts,
  5. Geometrical and network flow algorithms,
  6. Data structures.

-- Top 10 Algorithms and Data Structures for Competitive Programming

Baseline: ACM ICPC

The ACM ICPC is considered as the "Olympics of Programming Competitions". It is quite simply, the oldest, largest, and most prestigious programming contest in the world.

-- CodeChef, ICPC

Mission:

The ICPC, the “International Collegiate Programming Contest”, is an extra-curricular, competitive programming sport of the universities of the world. ICPC competitions provide gifted students with opportunities to interact, demonstrate, and improve their teamwork, programming, and problem-solving prowess. The ICPC is a global platform for academia, industry, and community to shine the spotlight on and raise the aspirations of the next generation of computing professionals as they pursue excellence.

Registration:

If a team wishes to be able to qualify for the ICPC World Finals, then before competing in ANY regional qualifying event, the coach and all team members must be fully registered in the ICPC Registration System. Registration may not be done retrospectively. Incomplete registration or circumvention that leads to incomplete or false data is grounds for immediate disqualification.

-- ICPC Rules

Data Science for team physics exploration

Stop oracles:

  1. Kaggle
    f

  1. The magic behind configure, make, make install ↩︎

  2. Documentation sources](https://kali.training/topic/documentation-sources/). ↩︎

  3. The ultimate cheat sheet ↩︎

  4. How to generate a random string? ↩︎

  5. What you didn't know about Bash functions ↩︎

  6. Steve Kemp, Dupes in Sysadmin Utils ↩︎