Listing posts
Displaying posts 16 - 20 of 369 in total
Sync date & time behind a proxy
Last update
2026-03-06
2026-03-06
« — »
/root/ntp-proxy.sh
1 2 3 4 | #!/bin/bash http_proxy=http://xxx:yyy https_proxy=http://xxx:yyy date -s "$(curl -H'Cache-Control:no-cache' -sI https://reachable-site.com | grep -i '^Date:' | cut -d' ' -f3-6)Z" |
root crontab
1 2 | # m h dom mon dow command 0 8 * * * /root/ntp-proxy.sh > /dev/null 2>&1 |
Source: superuser.com
~~~ * ~~~
Midnight Commander config & shortcuts
Last update
2026-02-23
2026-02-23
«MC: the "Midnight Commander".
Norton Commander clone/powerup»
Norton Commander clone/powerup»
Panel Functions
| Keys | Function |
|---|---|
TAB |
switch focus between panels |
Alt ? |
open search (find) dialog |
Alt s |
incremental search (press again for the next match) |
Alt i |
sync panels directories on current one |
Alt t |
switch among panel layouts in loop |
Ctrl r |
refresh active panel |
Ctrl u |
swap panels |
Common Functions
| Keys | Function |
|---|---|
Insert |
toggle mark on selected file |
* |
toggle marked files |
+ |
marks files based on a pattern |
- |
unmarks files based on a pattern |
Shift Down |
mark file and move to the next entry |
Shift Up |
mark file and move to the previous entry |
Shift F5 |
copy single file |
Shift F6 |
move single file |
Ctrl x c |
open chmod dialog for marked file |
Ctrl x o |
open chown dialog for marked file |
Ctrl x s |
make a symbolic link of the current file |
Shell functions
| Keys | Function |
|---|---|
Alt Enter |
copy selected filename in command line |
Ctrl Shft Enter |
copy full path of selected file in the command line |
Alt H |
shows command line history |
Useful settings
Here is my configuration (press F9 to navigate the menu):
Optionmenu |
Option |
|---|---|
| Configuration | check_box Verbose operation |
check_box Compute totals |
|
check_box Auto save setup |
|
| Layout | check_box_outline_blank Hintbar visible |
| Panel options | check_box_outline_blank Show hidden files |
check_box Auto save panels setup |
|
check_box File highlight > File types |
|
| Appearance | theme: modarin256-thin, xoria256, darkfar |
Left/Rightmenu |
Option |
|---|---|
| Listing format | check_box User defined > half mark type name | bsize:4 | mode:3 | mtime |
| Listing format | check_box User mini status > half name |
File actions
- Menu > Command > Edit extension file
- set
mpvfor video files - set
geeqiefor images - set
mcomixfor cbz/cbr
~/.config/mc/ini
1 2 3 | [Misc] timeformat_recent=%m/%d %H:%M timeformat_old=%Y %m %e |
Source: Klimer, MC HP, Kayxl, ArchLinux forum, SU time format
~~~ * ~~~
HAML syntax highlighting
Last update
2026-02-22
2026-02-22
«jedit, geany»
jEdit
- Append in
~/.jedit/modes/catalog:
1 | <MODE NAME="haml" FILE="haml.xml" FILE_NAME_GLOB="*.{haml,haml.erb}" /> |
- put the syntax file from wolfman's blog in
~/.jedit/modes:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | <?xml version="1.0"?> <!DOCTYPE MODE SYSTEM "xmode.dtd"> <!-- Edit mode for HAML ~ Version 1.1 - 2006-12-5 by Jim Morris 1. Place this file in ~/.jedit/modes/haml.xml 2. Append in ~/.jedit/modes/catalog: <MODE NAME="haml" FILE="haml.xml" FILE_NAME_GLOB="*.{haml,haml.erb}" /> Auto indents after lines starting with % with no trailing normal text (eg. %label{:id => 1}) or starting with "-". --> <MODE> <PROPS> <PROPERTY NAME="lineComment" VALUE="^\s*/" /> <PROPERTY NAME="noTabs" VALUE="true"/> <PROPERTY NAME="wrap" VALUE="none"/> <PROPERTY NAME="tabSize" VALUE="2"/> <PROPERTY NAME="indentSize" VALUE="2"/> <PROPERTY NAME="folding" VALUE="indent"/> <PROPERTY NAME="indentNextLines" VALUE="\s*(((%\S+)((\{.+\})|(\[.+\]))?)|(-\s+.*))" /> <PROPERTY NAME="noWordSep" VALUE="_-"/> </PROPS> <RULES IGNORE_CASE="TRUE"> <MARK_FOLLOWING TYPE="MARKUP">%</MARK_FOLLOWING> <MARK_FOLLOWING TYPE="KEYWORD2">#</MARK_FOLLOWING> <MARK_FOLLOWING TYPE="KEYWORD3">.</MARK_FOLLOWING> <EOL_SPAN TYPE="LITERAL3" AT_WHITESPACE_END="TRUE" DELEGATE="ruby::MAIN">=</EOL_SPAN> <EOL_SPAN TYPE="LITERAL2" AT_WHITESPACE_END="TRUE" DELEGATE="ruby::MAIN">-</EOL_SPAN> <EOL_SPAN TYPE="LITERAL2" AT_WHITESPACE_END="TRUE" DELEGATE="ruby::MAIN">~</EOL_SPAN> <SPAN TYPE="LITERAL1" NO_LINE_BREAK="TRUE"> <BEGIN>"</BEGIN> <END>"</END> </SPAN> <SPAN TYPE="LITERAL1" NO_LINE_BREAK="TRUE"> <BEGIN>'</BEGIN> <END>'</END> </SPAN> <SPAN TYPE="LITERAL4" NO_LINE_BREAK="TRUE" DELEGATE="ruby::MAIN"> <BEGIN>{</BEGIN> <END>}</END> </SPAN> </RULES> </MODE> |
Geany
- register the new Haml filetype in
~/.config/geany/filetype_extensions.conf
1 2 3 4 5 | [Extensions] Haml=*.haml;*.haml.erb [Groups] Markup=Haml; |
- add the syntax config in
~/.config/geany/filedefs/filetypes.Haml.conf
1 2 3 4 5 6 7 8 9 10 11 | # https://geany.org/manual/index.html#filetype-configuration [styling=Ruby] [settings] # https://github.com/geany/geany/tree/master/scintilla/lexilla/lexers lexer_filetype=Ruby extension=haml.erb [indentation] type=0 width=2 |
~~~ * ~~~
~~~ * ~~~
gitconfig global file and tools
Last update
2026-02-12
2026-02-12
« — »
- Setup a main config file in
/etc/gitconfigor~/.gitconfig:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | [alias] co = checkout ci = commit st = status df = diff --staged bd = branch --edit-description bds = !GIT_EDITOR=cat git branch --edit-description | grep -v "^#" pom = push origin master lom = pull origin master logs = log --show-signature list-files = ls-tree --name-only -r HEAD list-files2 = ls-tree --full-tree -r HEAD hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --date=short histg = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short undoci = reset --soft HEAD^ redoci = commit -c ORIG_HEAD undo-merge = reset --hard HEAD~1 stash-unapply = !git stash show -p | git apply -R stash-diff = stash show -p # drop all local commits and align with origin/master reset-om = reset --hard origin/master # side-by-side diff commands (install ydiff command) dfs = !git diff --staged | ydiff -s -w 0 -t 2 --wrap diffs = !git diff | ydiff -s -w 0 -t 2 --wrap # show root dir - https://stackoverflow.com/a/957978/13231285 root = rev-parse --show-toplevel [user] name = Alberto Cavalin email = acavalin@users.noreply.github.com [credential "https://github.com"] username = acavalin [core] autocrlf = input safecrlf = true excludesfile = ~/.gitignore_global # https://stackoverflow.com/a/37293198/13231285 hooksPath = ~/.git-hooks [push] default = current autoSetupRemote = true [color] ui = true [pull] ff = only rebase = false [init] defaultBranch = main [diff] algorithm = histogram |
- Quick config commands
1 2 3 4 5 6 7 8 9 | # Better diff algorithm git config --global diff.algorithm histogram # Auto set upstream on push git config --global push.autoSetupRemote true # Enable adding CR/LF files git config --global core.autocrlf false git config --global core.safecrlf false |
- Setup the ignore list in
~/.gitignore_global:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # jEdit temporary files *.marks \#Untitled-*# # Rails files (db, log, temp, cfg) /db/*.sqlite3 /db/*.sqlite3-journal /log/*.log /log/*.gz /tmp Gemfile.lock /config/database.yml .DS_Store nohup.out |
Use a side-by-side colored diff tool
Enhance the terminal experience:
fish: see Prompt power-up section on dedicated my fish postbash: source the git completion scripts in~/.bashrc:
1 2 3
[ -f "$HOME/.git-completion.bash" ] && source "$HOME/.git-completion.bash" [ -f "$HOME/.git-prompt.sh" ] && source "$HOME/.git-prompt.sh" export PROMPT_COMMAND='__git_ps1'
Install some good interfaces for git:
1 2 | apt-get install tig # ncurses-based text-mode interface apt-get install gitg # gtk visual repository viewer |
- Look for a file in a project:
1 2 3 4 | grep -E --color=always \ --exclude-dir=".git" --exclude-dir="log" --exclude-dir="tmp" \ --exclude="#*#" \ -rin search_term . | less -R |
- Make a single file full backup
1 2 | git bundle create project.bundle --all # backup git clone project.bundle dir # restore |
On the first pull/push saves user/pass in plaintext in ~/.git-credentials.
1 2 | # run this to configure the local repository
git config credential.helper store
|
Source: cache username/pass via StackOverflow and GitHub; dev.to git terminal, side-by-side diff, add CR/LF files, dev.to
