//header | |
#pragma GCC target ("avx2") | |
#pragma GCC optimize ("O3") | |
#pragma GCC optimize ("unroll-loops") | |
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long int ll; | |
typedef long double ld; |
# update system
sudo apt update && sudo apt upgrade -y
# install build tools and python prerequisites
sudo apt install build-essential libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev libffi-dev
# download and extract python
// Link to the original: http://www.jsoftware.com/jwiki/Essays/Incunabulum | |
// Found at https://news.ycombinator.com/item?id=8533843 | |
typedef char C; | |
typedef long I; | |
typedef struct a { | |
I t,r,d[3],p[2]; | |
}* A; |
Below are the Big O performance of common functions of different Java Collections. | |
List | Add | Remove | Get | Contains | Next | Data Structure | |
---------------------|------|--------|------|----------|------|--------------- | |
ArrayList | O(1) | O(n) | O(1) | O(n) | O(1) | Array | |
LinkedList | O(1) | O(1) | O(n) | O(n) | O(1) | Linked List | |
CopyOnWriteArrayList | O(n) | O(n) | O(1) | O(n) | O(1) | Array |
// Based on the article 'Combinators for logic programming' by Michael Spivey and Silvija Seres. | |
// Original author's blog post: http://ademar.name/blog/2011/06/combinators-for-logic-programm.html | |
// More info about this language: https://en.wikipedia.org/wiki/F_Sharp_(programming_language) | |
let rec inf_seq n = seq { yield n; yield! inf_seq (n+1) } | |
let rec lzw f l1 l2 = | |
LazyList.delayed ( fun () -> | |
match l1,l2 with | |
|LazyList.Nil, _ -> l2 |
A lot of GitHub projects need to have pretty math formulas in READMEs, wikis or other markdown pages. The desired approach would be to just write inline LaTeX-style formulas like this:
$e^{i \pi} = -1$
Unfortunately, GitHub does not support inline formulas. The issue is tracked here.
BEWARE/ACHTUNG: The Bash script below doesn't work as-is on a GNU/Linux system, as GNU/Linux doesn't have the osascript
OSX binary, as this is a native binary in OSX (see: OS X man page of osascript, how to use osascript binary within an OS X system). Please monitor the ticket at the repo of the python osascript
binary. This is our best shot.
- "Show macOS notification when long running command finishes and your terminal is not in focus." (from the title).
- So it seems that the suggestion script is meant to run on OSX only (hence the
osascript
call). - I was able to find this (
osascript
) python package that seems to do that same thing. I'll test this. - Well, the previously found interesting looking PyPy solution,
osascript
is failing to work with my o
Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
Bob Martin's book in Amazon.
- Follow standard conventions.
- Keep it simple stupid (KISS). Simpler is always better. Reduce complexity as much as possible.
- Boy scout rule. Leave the campground cleaner than you found it.
- Always find root cause. Always look for the root cause of a problem.