Skip to content

Instantly share code, notes, and snippets.

View baurzhan-konurbayev's full-sized avatar

Baurzhan Konurbayev baurzhan-konurbayev

View GitHub Profile
@baurzhan-konurbayev
baurzhan-konurbayev / understanding_ls_l_linux.md
Created September 25, 2023 05:58
Understanding the Execution of `ls -l` in Linux

Understanding the Execution of ls -l in Linux

  1. Command Input:

    • The user types ls -l in the terminal, and the shell reads this input.
  2. Command Parsing & PATH Variable:

    • The shell parses the command and its arguments.
    • The shell searches for the ls binary in the directories listed in the PATH environment variable.
  3. Permission & Access Check:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCz7oMPKkaM3s4Q1t1lZ9V4HPxeh9OtMIVEfzl7vmcEDRORAu7ne5NKww7KbFHPJdl1USF59ZY1W1ANu8hqRHIdKbUptASWBTGSkDWrDEF467YEwio/ONRHgStjvy6Z1xI2yltaouyz6+p21GfPY7/miXOSBmPy5ObuUcBgz+hLullq50hi0uLCkoYPH4p9uTtW0gMR9h7N06AZPb8sh1+vQOAA9QMc00XaahVlwwdZDKvYL4mOh7yCIHUSJojaTugwEngCJNDegwRBn8OAML0awY5daKaAON5PQx4qAqAsGrl10yyZmtaK4Ec3LSD6IYAT950x0gimKN0P4rBSFJ0XSGfQH5hcCpQCshncS6ivmvKR0V8Zr5TEUKymYvgCjA0q5n4Mkx4vl3M3WpOt5hv7nLfWlzNlnK17Kdn2c3fJiHu/eR/mO6R1e2L/Bn6s3uTimoNDmajpgfsYPqPragYPoI3TP5OTp+m5QL2YFVl6IySuGHZIvxp8HTrr4KwgYvnOEvUfjWofP1YstwvWNPSDhs9zQqO6Ka0VNXiQNWBVDSonG9JUU7mh9LQl7ieHKqojj1gbj6tUXY+yxboVCPwc/lBdl+fQdNTCOFFB8K0SJBcO/sEZaepCC4ZPp1ExKbgjAOnBFLYj70zC1vwMsOLycH+nQ18nIyIGHG07TOdnQ== baurzhan@MacBook-Pro.home
@baurzhan-konurbayev
baurzhan-konurbayev / merge_lists.py
Last active November 11, 2022 16:46
Merge lists with identical IDs
input = [[1,2,3],
[3],
[4],
[5,6],
[1,7],
[2,8],
[4,9]]
"""
# Configure Ruby and Gems paths on Mac
export RUBY_PATH=/usr/local/opt/ruby/bin
export PATH="$RUBY_PATH:$PATH"
export RUBY_VERSION=$($RUBY_PATH/ruby -e "puts RUBY_VERSION")
export PATH="/usr/local/lib/ruby/gems/$RUBY_VERSION/bin:$PATH"
export GEM_HOME="$HOME/.gem"
export GEM_PATH="$GEM_HOME/ruby/$RUBY_VERSION"
I'll be omitting syscalls with ellipsis.
The first thing that happens after you press enter is that bash resolves
curl to /usr/bin/curl and then forks(). The strace output is from the
forked process.
Fist execve() the /usr/bin/curl binary and pass an array of arguments to it.
execve("/usr/bin/curl", ["curl", "http://github.com"], [/* 8 vars */]) = 0
...
@baurzhan-konurbayev
baurzhan-konurbayev / gist:5eb4eebeaa0da3f5bc2fdf560e977f75
Created July 13, 2020 20:10 — forked from t2psyto/gist:f5453707d2658173715f49293d096fe5
powershell oneliner for encode/decode base64 to file
# encode from binary file to base64txt
powershell -C "& {$outpath = (Join-Path (pwd) 'out_base64.txt'); $inpath = (Join-Path (pwd) 'data.jpg'); [IO.File]::WriteAllText($outpath, ([convert]::ToBase64String(([IO.File]::ReadAllBytes($inpath)))))}"
# decode from base64txt to binary file
powershell -C "& {$outpath = (Join-Path (pwd) 'outdata2.jpg'); $inpath = (Join-Path (pwd) 'out_base64.txt'); [IO.File]::WriteAllBytes($outpath, ([convert]::FromBase64String(([IO.File]::ReadAllText($inpath)))))}"
# recipe1.rb, which I am writing test for
powershell_script "Check if service needs to be restarted" do
code XXXX
notifies :restart, windows_service[resource_from_other_collection], :delayed
action :run
end
# recipe2.rb, which I am writing test for
windows_service "resource_from_other_collection" do
action :nothing
@baurzhan-konurbayev
baurzhan-konurbayev / git-pre-receive-hook.sh
Created February 20, 2019 17:13 — forked from caniszczyk/git-pre-receive-hook.sh
A reasonable git pre-receive-hook
#!/bin/sh
#
# For each ref, validate the commit.
#
# - It disallows deleting branches without a /.
# - It disallows non fast-forward on branches without a /.
# - It disallows deleting tags without a /.
# - It disallows unannotated tags to be pushed.
public List<Evaluation> findEvaluationsAssignedToUser(String login, Integer tenderId, Integer proposalId) {
Connection connection = null;
PreparedStatement preparedStatement = null;
List<Evaluation> evaluations = new ArrayList<>();
System.out.println("from EvaluationDaoImpl findEvaluationsAssignedToUser start" + evaluations);
try {
System.out.println("from findEvaluationsAssignedToUser page login" +login+" tenderId "+ tenderId+" proposalId "+proposalId);
connection = ConnectionPool.getInstance().getConnection();
preparedStatement = connection.prepareStatement(PREPARED_STATEMENT_EVALUATION_FIND_BY_USER);
preparedStatement.setString(1, login);
https://github.com/facebook/chef-cookbooks/blob/master/README.md
https://github.com/facebook/chef-utils/blob/master/Philosophy.md
Example cookbook: https://github.com/facebook/chef-cookbooks/tree/master/cookbooks/fb_cron