Summary | How to control (or Understand) your GIST page's files list order. |
Notice | not official documentation. |
This file contains hidden or 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
# Set delete / backspace key to work like most text editors | |
set backspace=indent,eol,start | |
# Links to More + Quick Start Guide : | |
https://vim.rtorr.com |
This file contains hidden or 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
# screen is useful command as it is included by default on some distributons / operating systemss (eg MacOS). | |
# even if you really like tmux, screen is useful in some situations. Both screen and tmux have a good use cases. | |
# list all screen sessions | |
screen -list | |
# start a command in screen | |
screen -S my_commands_awesome_name -md bash -lc /usr/bin/path_to_my_awesome_command | |
# start a command via ssh in screen |
This file contains hidden or 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
# netstat (more similar to GNU/LINUX) on macOS | |
lsof -i -P | grep -i "listen" --line-buffered |
This file contains hidden or 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
#!/usr/bin/env bash | |
# find files within folder with creation time falling between 6PM and 9AM (change as required). | |
for f in /myfolder/* ; do | |
var=$(date -r "$f" '+%H') | |
if [ $var -gt 18 ] || [ $var -lt 9 ] ; then | |
ls -l "$f" | |
fi | |
done |
This file contains hidden or 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
#!/bin/bash | |
# (C)2020 Henri Shustak | |
# Relased Under MIT LICENCE | |
# https://mit-license.org/ | |
# benchmark bash function | |
# requires gdate to be installed (part of coreutils) | |
# This system is very basic and has some serious limitiations. |
This file contains hidden or 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
# select lines which start with upper case or lower case letter at the start of the line | |
grep -E "^[a-z]|[A-Z]" | |
# enable line buffering (useful for dealing with pipes and real time loops) | |
grep --line-buffered "search term" | |
# enable highlighting for a match but do not filter output (all of these examples will have a similar effect) | |
ack --passthru 'hightlight-match-string' | |
grep "^\|highlight-match-string" --color="always" | |
grep "^\|highlight-match-string" --color |
This file contains hidden or 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
Some programs will automatically save changes when closing files - Plan is to make a repository with a bunch of defaults which I use. For now it is a GitHub Gist. | |
Programs which seem to do this are listed below : | |
- Texttastic : https://www.textasticapp.com | |
More default settings now availble in a repository : | |
https://github.com/henri/handy-settings-macOS/ | |
---- CLI Details ---- |
This file contains hidden or 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
#!/bin/bash | |
# simple script for macOS systems. It will switch to the location specified below if it is exists. | |
switch_to_location="Automatic" | |
current_location=`scselect | grep "*" | grep -v "Defined sets include: " | awk -F "(" '{print $2}' | awk -F ")" '{print $1}'` | |
if [ "{$current_location}" != "{$switch_to_location}" ] ; then | |
scselect "${switch_to_location}" | |
exit $? | |
fi |
This file contains hidden or 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
# macOS 10.15 and later | |
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder |