Skip to content

Instantly share code, notes, and snippets.

@mtilson
mtilson / README.md
Last active March 31, 2022 09:18
how to deal with linux file and directory permission [linux] [security] [filesystem]

FlowerPuzzleM

Linux File Permission Cheat Sheet

  • Necessary and sufficient knowledge on Linux file and directory permissions
  • With practical examples
  • Sourced from GitHub

User permission triads

  • There are three permission triads (rwx rwx rwx) corresponding to particular group of users
  • The 1-st one (rwx --- ---) is for owner user
@mtilson
mtilson / README.md
Last active August 1, 2020 13:15
what are basic process management primitives in linux kernel [linux] [kernel]

Linux makes a distinction between process and program executing

System calls

  • exec()-like
    • related to program executing
    • load a new program
    • after the call the process resumes execution with a brand new address space containing the loaded program
  • fork()
    • related to process executing
    • create a new process
  • the process that invokes a fork() is the parent process
@mtilson
mtilson / README.md
Last active April 13, 2020 19:54
what is introduced by feature branch OR what are the differences in triple-dot notations for 'git log' and 'git diff' [git]
Background
  • Let's say we have two users (schacon and jessica) both having write access to the same GitHub repo
[user@pro13 schacon (master)]$ git log --oneline --all 
* 6c4e96c (HEAD -> master, origin/master, origin/HEAD) Initial commit

[user@pro13 schacon (master)]$ git remote -v
origin	https://github.com/txxxx-xx/xxx.git (fetch)
origin	https://github.com/txxxx-xx/xxx.git (push)
@mtilson
mtilson / README.md
Last active April 13, 2020 09:44
what useful refs are inside '.git' directory, part 3 - special names for commits [git]
  • HEAD - pointer to the local branch you’re currently on (reference to the most recent commit in curent branch)
    • $ cat .git/HEAD
ref: refs/heads/master
  • refs/remotes/origin/HEAD - is the same type of pointer as local HEAD, but for origin remote
    • all refs/remotes/origin/* are remote-tracking branches which are local references (to the state of remote branches) that you can’t move
      • Git moves them for you whenever you do any network communication, to make sure they accurately represent the state of the remote repository
      • think of them as bookmarks, to remind you where the branches in your remote repositories were the last time you connected to them
      • git fetch <remote-name> updates your remote-tracking branches
@mtilson
mtilson / README.md
Last active April 9, 2020 03:27
what are useful operations with Git remote branches [git]

All the details are based on [Git Remote Branches] unless otherwise stated


Sharing a Branch with the World

Create and push a branch on one workplace (WP), and fetch and check out the branch on another workplace

  • Create and push on workplace 1
WP1> git branch fix
WP1&gt; git checkout fix
@mtilson
mtilson / README.md
Last active April 13, 2020 08:58
what useful refs are inside '.git' directory, part 2 - GitHub mirrored bare repo [git]

We have only one remote

  • $ git remote
repo-to-fetch

Directory structure

  • $ tree -L 1
.
@mtilson
mtilson / README.md
Last active April 13, 2020 08:57
what useful refs are inside '.git' directory, part 1 - cloned (non-bare) repo [git]

We have only one remote

  • $ git remote
origin

Directory structure

  • $ tree -L 1 .git
.git
@mtilson
mtilson / script.sh
Last active February 8, 2024 17:51
what are GitHub 'refs/pull/*' refspecs and how to get full copy of GitHub repo [git] [github]
#!/usr/bin/env bash
# we are going to fetch all refs (including 'refs/pull/*') from Git remote
# 'repo-to-fetch', which points to public GitHub repo defined by URL
# '${repoURL}' where the GitHub user account '${userName}' has write access
# for more details on GitHub 'refs/pull/*' refspecs see [1]
userName=mxxxxxx
[email protected]
repoURL=https://github.com/txxxx-xx/gxx-xxxx.git
@mtilson
mtilson / script.sh
Last active April 7, 2020 08:54
how to set Git repository and global options for multiple GitHub accounts [git] [github]
#!/usr/bin/env bash
# let's say we have GitHub 'org' with 'team' of 2 members
# ('member1', 'member2') having Write access to
# 'repo' with URL of 'https://github.com/org/repo.git'
# we are going to setup repository and global Git options
# (on macOS) to be able to commit to 'repo' using the
# above GitHub user accounts including different network
# authentication
@mtilson
mtilson / _script.sh
Last active November 14, 2022 08:26
how to trigger GitHub Actions workflows in different ways [git] [github] [workflow] [webhook]
#!/usr/bin/env bash
set -e
# we are going to setup different GitHub Actions workflows on
# GitHub repo '${repoName}' under GitHub user account '${userName}'
# which has Write access to the repo
# to trigger 'webhook' event with help of 'curl' command we use
# 'Authorization' header with personal access token '${token}' which
# has to be created aforehand, see [2]