Skip to content

Instantly share code, notes, and snippets.

View hvmonteiro's full-sized avatar

Hugo Monteiro hvmonteiro

View GitHub Profile
@hvmonteiro
hvmonteiro / legal-notice-example01
Last active April 5, 2024 14:36
LEGAL Notices for Login/MOTD unix banners
@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 / .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 / .bashrc
Last active January 24, 2018 11:32
Get 'less'' command to display highlighted content
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
umask 0002
eval "$( dircolors -b "$HOME/.LS_COLORS" )"
# Uncomment the following line if you don't like systemctl's auto-paging feature:
@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 / helloserver.c
Created September 19, 2016 09:58
'Hello World' TCP/IP based server daemon
/**************************************************************************/
/***************************************************************************
HELLOSERVER.C - a 'Hello World' TCP/IP based server daemon
Implements a skeleton of a single process iterative server
daemon.
Wherever possible the code adheres to POSIX.
@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 / ssh_config
Last active January 22, 2019 16:27
SSH Configuration file
#
# WARNING: This configuration file is only suitable for usage in development environments on private networks,
# as it supresses and works around most information messages about SSH related security issues!
#
# Always authenticate with user 'root'
Host *
User root
# Automatically add remote host keys
@hvmonteiro
hvmonteiro / package.js
Created February 22, 2017 14:54
Get electron-download pre-compiled binnaries for every platform to local cache directory.
const download = require('electron-download');
var downloadVersion = '1.4.15';
if (process.argv > 2) {
var downloadVersion = process.argv[2];
console.log('Using specified version', downloadVersion, '...');
} else {
console.log('Version', process.argv[2], 'using default', downloadVersion, '...');
}
@hvmonteiro
hvmonteiro / is_tcp_port_active.sh
Last active February 23, 2017 12:10
Linux: Test TCP Port when there is no telnet available
# Copy/paste directly into bash shell or source a file with the function below:
# --- cut here ---
is_tcp_port_active () {
if [ "$1" == "" -o "$2" == "" ]; then
echo -e "\n usage: is_tcp_port_active <hostname> <port>\n"
return 1
fi
HOST=$1;
PORT=$2;
echo "$HOST:$PORT";