Skip to content

Instantly share code, notes, and snippets.

@carlos-teles
carlos-teles / gist:83e97c2b4869263035762af2380af6e9
Created April 10, 2024 17:31
Replacing all occurrences of one string with another in all files in the current directory:
These are for cases where you know that the directory contains only regular files and that you want to process all non-hidden files. If that is not the case, use the approaches in 2.
All sed solutions in this answer assume GNU sed. If using FreeBSD or macOS, replace -i with -i ''. Also note that the use of the -i switch with any version of sed has certain filesystem security implications and is inadvisable in any script which you plan to distribute in any way.
Non recursive, files in this directory only:
sed -i -- 's/foo/bar/g' *
perl -i -pe 's/foo/bar/g' ./*
(the perl one will fail for file names ending in | or space)).
@carlos-teles
carlos-teles / ruby proxy
Created February 20, 2024 12:02 — forked from gmic/ruby proxy
Ruby: install gems behind a proxy
gem install --http-proxy http://user:password@some.proxy.com:8080 bundler
@carlos-teles
carlos-teles / Oracle Instant Client on Debian or Ubuntu
Created September 13, 2023 18:43 — forked from phartenfeller/Oracle Instant Client on Debian or Ubuntu
Install an oracle instant client on a Debian or Ubuntu linux
apt-get install -y libaio1 alien
# Change version based on https://www.oracle.com/de/database/technologies/instant-client/linux-x86-64-downloads.html
# Example alternative: http://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/getPackage/oracle-instantclient19.5-basiclite-19.5.0.0.0-1.x86_64.rpm
wget http://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/getPackage/oracle-instantclient19.6-basic-19.6.0.0.0-1.x86_64.rpm
sudo alien -i --scripts oracle-instantclient*.rpm
rm -f oracle-instantclient*.rpm
# Optionally install SQLPlus
wget http://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/getPackage/oracle-instantclient19.6-sqlplus-19.6.0.0.0-1.x86_64.rpm
sudo alien -i --scripts oracle-instantclient*.rpm

Here are several different ways to test a TCP port without telnet.

$ cat < /dev/tcp/127.0.0.1/22
SSH-2.0-OpenSSH_5.3
^C

$ cat &lt; /dev/tcp/127.0.0.1/23
@carlos-teles
carlos-teles / gist:8ca1900930c8a5df1b17cdc026cda1a1
Created March 9, 2023 21:01
Send syslog linux from nc - netcat
echo '<14>_sourcehost_ messagetext' | nc -v -u -w 2 _desthost_ 514
Example:
echo '<14>192.168.0.5 messagetext' | nc -v -u -w 2 192.168.0.105 514
@carlos-teles
carlos-teles / history uptime
Last active December 20, 2022 12:32
history uptime
.
@carlos-teles
carlos-teles / network attack
Created December 20, 2022 12:17
network attack
.
@carlos-teles
carlos-teles / cron
Last active December 20, 2022 11:48
crontab
https://crontab.guru/
@carlos-teles
carlos-teles / dns
Last active December 20, 2022 11:45
dns
.
@carlos-teles
carlos-teles / cicd
Last active December 20, 2022 11:30
cicd
.