Skip to content

Instantly share code, notes, and snippets.

View hvmonteiro's full-sized avatar

Hugo Monteiro hvmonteiro

View GitHub Profile
@joshschmelzle
joshschmelzle / list-ssh-sessions.md
Last active August 4, 2023 11:23
List all connected SSH sessions

How to list all connected SSH sessions

I was curious how to view sessions on a Linux box I had at my desk. Similar to the session table on an Aruba controller (show loginsessions). Here are some ways you can list active SSH sessions; some commands return more output than others. This applies to most modern Linux boxes or say a WLAN Pi.

All examples below are using 2 MobaXterm user sessions from a Windows machine to a Linux 4.14.42-sunxi64 aarch64 (NanoPi NEO2).

w

wlanpi@wlanpi:~$ w
@hvmonteiro
hvmonteiro / notepad_plus_log4j.xml
Created September 26, 2016 12:25
Notepad++ User Defined Language Syntax Highlight: Log4J
<NotepadPlus>
<UserLang name="Log4J" ext="log" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="2" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00 01 02 03 04</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>
@hvmonteiro
hvmonteiro / .vimrc
Last active March 29, 2020 19:27
VIM custom settings using shellcheck with syntastic
"
" Author: Hugo Monteiro
" Description: Customized VIM settings with syntax checker, highlighting nad error follow up
" and jshint (if installed)
" Last Changed: 01-03-2018
" Notes: File to be used as ~/.vimrc
"
"color desert
"color darkblue
@hvmonteiro
hvmonteiro / .screenrc
Created April 20, 2016 14:24
Screen resource file (~/.screenrc)
# Look and feel
hardstatus alwayslastline "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<"
# Number of output lines saved that can be scrolled
defscrollback 20000
# Status bar
caption always "%{= bb}%{+b w}Screen: %n | %h %=%t %c"
#caption always '%{-b}%{= wb}%-Lw%{= wr}%{+b}%n%f %t%{= wb}%{-b}%+Lw %{= wr} %=%c %d-%m-%Y'
@hvmonteiro
hvmonteiro / snippets.cson
Created April 19, 2016 13:59
Atom Editor snippets for Bash Shell Scripting
#
# Author: Hugo Monteiro
# Description: Atom Editor snippets for Bash Shell Scripting
# URL : https://gist.github.com/hvmonteiro/4c4df4afd0f4d5908d5be890071b74c1
# Last Changed: 19-04-2016
# Installation: File to be copy/pasted into Atom Editor snippets configuration file
'.source.shell':
# function to print a message and exit with an error
'function exit_with_error':
@hvmonteiro
hvmonteiro / legal-notice-example01
Last active April 5, 2024 14:36
LEGAL Notices for Login/MOTD unix banners
@hvmonteiro
hvmonteiro / putty-hvm-settings.reg
Last active August 17, 2021 14:35
PuTTY Customized Settings
Windows Registry Editor Version 5.00
;
; Author: Hugo Monteiro
; Description: Customized puTTY settings
; URL : https://gist.github.com/hvmonteiro/6f1f2acd602c1db3c546fe30761a8d20
; Last Changed: 17-04-2016
; Installation: File to be imported/merged into Windows Registry
; Notes: LOCALE is configured to: ISO-8859-1:1998 (Latin-1, West Europe) - You can change it after import
;
[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\Default%20Settings]
@hvmonteiro
hvmonteiro / packages.cson
Created April 15, 2016 19:07
Atom.io Editor Packages (file: ~/.atom/packages.cson)
packages: [
"api-docs"
"atom-autocomplete-php"
"atom-beautify"
"atom-css-comb"
"atom-html-preview"
"atom-webbrowser"
"auto-detect-indentation"
"autoclose-html"
"autocomplete-html-entities"
@hvmonteiro
hvmonteiro / .jshintrc
Last active March 1, 2018 12:44
Custom JSHint options (file: ~/.jshintrc)
{
"nocomma": false,
"esversion": 6,
"globals": [ {
"require": true,
"__dirname": true,
"process": true,
"module": true,
"console":, true
}]
@hvmonteiro
hvmonteiro / debug.lib
Created April 12, 2016 18:42
Bash Scripts
#!/bin/bash
DEBUG_FILE="debug.log"
LOG_FILE="info.log"
FAILURE=1
SUCCESS=0
# Outputs a message to the console
_print_msg () {