- Make each program do one thing well. To do a new job, build afresh rather than complicate old programs by adding new features.
- Expect the output of every program to become the input to another, as yet unknown, program. Don’t clutter output with extraneous information. Avoid stringently columnar or binary input formats. Don’t insist on interactive input.
- Design and build software, even operating systems, to be tried early, ideally within weeks. Don’t hesitate to throw away the clumsy parts and rebuild them.
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
# This is a script to make short records about activities with time spent in minutes. | |
# Dependencies: | |
# - tac - (install: $ brew install coreutils) | |
# - align - (install: https://github.com/Guitarbum722/align/tree/master/cmd/align, $ go build -o align && go install) | |
# | |
# You can add alias with shortcuts to your bash/zsh config: | |
# alias mr='/Users/leonid/bash-scripts/make_record.sh add' | |
# alias mrs='/Users/leonid/bash-scripts/make_record.sh show' | |
# alias mrsf='/Users/leonid/bash-scripts/make_record.sh show-filter' | |
# alias mre='/Users/leonid/bash-scripts/make_record.sh edit' |
I hereby claim:
- I am leonid-ed on github.
- I am leonided (https://keybase.io/leonided) on keybase.
- I have a public key ASABKy69asMsnQRSChUTFtYgLtzc0YNEwDeOnCiwJIWBkAo
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
" Inspired by https://vim.fandom.com/wiki/Visual_selection_of_indent_block | |
" This version additionaly goes through empty lines to select also separated blocks | |
" on the same indent level. | |
function SelectIndentOn() | |
let temp_var=indent(line(".")) | |
if temp_var is 0 | return | endif | |
while (line(".") > 1) && | |
\ ((indent(line(".")-1) >= temp_var) || (getline(line(".")-1) is "")) | |
exe "normal k" |
In this article we compared different behavior of static
, inline
and static inline
free functions in compiled binary.
All the following test was done under g++ 7.1.1 on Linux amd64, ELF64.
#pragma once
inline int only_inline() { return 42; }
static int only_static() { return 42; }
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 WeightedQuickUnionWithPathCompressionUF(): | |
"""Weighted quick-union with path compression algorithm | |
The original Java implementation is introduced at: | |
https://algs4.cs.princeton.edu/15uf/index.php#1.5 | |
https://www.cs.princeton.edu/~rs/AlgsDS07/01UnionFind.pdf | |
Time complexity: | |
constructor: O(n) | |
union: amortized ~O(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
# The MIT License (MIT) | |
# Copyright (c) 2016 Leonid Edrenkin | |
# | |
# This is a Sublime Text 3 plugin that copies selected lines to the clipboard. | |
# You should select text lines and apply command: | |
# view.run_command('copy_lines_to_clipboard') | |
# view.run_command('copy_lines_to_clipboard', {"with_filename": True}) | |
# view.run_command('copy_lines_to_clipboard', {"with_filename": True, "tabsize" : 4}) |
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 MIT License (MIT) | |
# Copyright (c) 2016 Leonid Edrenkin | |
# | |
# This is a Sublime Text 3 plugin that makes and unmakes a numberred list. | |
# You should select text lines and apply one of commands: | |
# view.run_command('make_numberred_list') | |
# view.run_command('unmake_numberred_list') | |
import sublime, sublime_plugin |
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 MIT License (MIT) | |
# Copyright (c) 2016 Leonid Edrenkin | |
# | |
# This is a Sublime Text 3 plugin that makes an adjusted multiline C-macro. | |
# You should select some code and apply one of commands: | |
# view.run_command('make_multi_line_macro') | |
# view.run_command('unmake_multi_line_macro') | |
import sublime, sublime_plugin |
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 MIT License (MIT) | |
# Copyright (c) 2016 Leonid Edrenkin | |
# | |
#!/bin/bash | |
case "$2,$3" in | |
message,HEAD) | |
;; | |
*) |
NewerOlder