Nerdy Notes
Search This Blog
2022-05-28
2021-09-25
Media Tracking and Recommendation Services
Anime
Movies
TV Shows
2020-09-27
Windows 10 Hardware Temperature Monitoring Tools
Tool to monitor temperature of hardware components in Windows 10
Open Hardware Monitor - portable open source version of hwmonitor
Core Temp - more CPU measurement features
hwinfo - similar to Open Hardware Monitor and has thermal throttling detection
2020-09-23
Terminal Ping Sweep and Port Scan
Result: List of IP addresses that respond to ping on the specified prefix. Scan common ports on devices that respond to ping.
- Modify the prefix variable as necessary, and paste into terminal
- Copy and Paste the rest of the following script into the terminal application
prefix="192.168.0."
for i in {1..100} do ping -c1 -W1 -i0.2 $prefix$i > /dev/null if [ $? -eq 0 ] then echo $prefix$i nc -w 1 -vz $prefix$i 1-1056 2>&1 | grep succeeded fi done
2020-08-15
Windows cmd ping sweep
Instead of installing a third party application which has the possibility to have spyware or other bad stuff in it. If you only need to do a ping sweep with no additional features it's probably easier just to do it in CMD.
- Open up cmd
- Run the following
for /L %z in (1,1,254) do @ping 10.0.0.%z -w 10 -n 1 | find "Reply"
Where:
- (1,1,254) indicates to test every address from 1-254
- 10.0.0. is the network address prefix of addresses you want to test
- %z is filled in with numbers from (1,1,254)
- -w 10 - only waits 10ms before moving on
- -n 1 - only tries once before moving on
- find "Reply" looks for a succesful ping result and ignores unsuccessful
2015-12-07
Clean Console Log Output
To remove colour codes and redraw characters from console to make console logs more readable.
Usage:
#!/usr/bin/env perl
while (<>) {
s/ \e[ #%()*+\-.\/]. |
(?:\e\[|\x9b) [ -?]* [@-~] | # CSI ... Cmd
(?:\e\]|\x9d) .*? (?:\e\\|[\a\x9c]) | # OSC ... (ST|BEL)
(?:\e[P^_]|[\x90\x9e\x9f]) .*? (?:\e\\|\x9c) | # (DCS|PM|APC) ... ST
\e.|[\x80-\x9f] //xg;
print;
}
Usage:
less /path/to/console.log | cleanLog | less
2015-07-21
Limiting Bandwidth Using Robocopy
Robocopy does not have any built in bandwidth limiter by rate specifically.
But what you can do is use the inner packet gap switch
The equation to use to calculate is as follows:
Where
D is the calculated latency or inner packet gap
Bd is the desired bandwidth you would like to transfer at
Ba is the available bandwidth to you
Example:
If my
Bd is 200kbps
Ba is 1000kbps
Therefore my /ipg:n will be /ipg:2048
References:
https://yellowtriangle.wordpress.com/2012/06/28/bandwidth-throttling-with-robocopy/
http://www.zeda.nl/index.php/en/copy-files-on-slow-links
https://technet.microsoft.com/en-us/library/cc733145.aspx
But what you can do is use the inner packet gap switch
/ipg:n
to simulate a lower bandwidth by adding more delay between packets.The equation to use to calculate is as follows:
Where
D is the calculated latency or inner packet gap
Bd is the desired bandwidth you would like to transfer at
Ba is the available bandwidth to you
Example:
If my
Bd is 200kbps
Ba is 1000kbps
D=((1000-200)/(1000*200))*512*1000=2048
Therefore my /ipg:n will be /ipg:2048
References:
https://yellowtriangle.wordpress.com/2012/06/28/bandwidth-throttling-with-robocopy/
http://www.zeda.nl/index.php/en/copy-files-on-slow-links
https://technet.microsoft.com/en-us/library/cc733145.aspx
2015-07-11
Sourcing Files in Bash
I never quite understood why when you changed .bashrc you had to type the source command in order to make changes active.
Now I understand and it's fairly straight forward.
Your current bash environment is defined by a PID that can be found using
Any newly spawned bash processes for scripts will fork off of that process and be given a new process ID.
All variables for that newly spawned process will be local to that newly forked process.
If you would like the variables that would typically be local to your forked script to be active in your current shell you can use the
This acts in the same way when you would like to make variables in the .bashrc script local to your current shell. When the computer boots it runs .bashrc and puts variables in your current shell. If you would like to make any variable changes to re-read into your current shell. Similarly to how you would make variables to a remote script available to your local shell by using the source command you can do the same for .bashrc
Example:
The above will make all variables in script.sh available to your local shell at
The above will make all variables in script .bashrc available to your local shell at
Now I understand and it's fairly straight forward.
Your current bash environment is defined by a PID that can be found using
echo $$
Any newly spawned bash processes for scripts will fork off of that process and be given a new process ID.
All variables for that newly spawned process will be local to that newly forked process.
If you would like the variables that would typically be local to your forked script to be active in your current shell you can use the
source
command in order to make them local to your current shell.This acts in the same way when you would like to make variables in the .bashrc script local to your current shell. When the computer boots it runs .bashrc and puts variables in your current shell. If you would like to make any variable changes to re-read into your current shell. Similarly to how you would make variables to a remote script available to your local shell by using the source command you can do the same for .bashrc
Example:
source script.sh
The above will make all variables in script.sh available to your local shell at
echo $$
source .bashrc
The above will make all variables in script .bashrc available to your local shell at
echo $$
2015-04-29
Create Redhat Syncronized Repo with Reposync
Prerequisites
- Server registered with the appropriate version of RedHat
- HTTP/FTP server to host repo files
Instructions
Install required components for managing yum repositories and createrepo utility for building new repo indexes.
yum install yum-utils createrepo
Register with RedHat to gain access to their repos
rhn_register
OR
subscription-manager register --username $username --password $password --auto-attach
Repos will be populated automatically upon registration and you can then list them using:
subscription-manager repos --list
Download the repos to a path of your chosing
reposync --gpgcheck -l --repoid=$repoid --download_path=$path
Create the repo against the directory where your rpm packages exist
cd $path
createrepo $path
Enable the local repo
vi /etc/yum.repos.d/rhel.repo
[rhel-repo]
name=Red Hat Enterprise Linux 7 - x86_64
baseurl=http://$server/$path
enabled=1
gpgcheck=0
Ensure the repo works, this will likely build the index at the same time. I've seen elsewhere where cache is refreshed using yum makecache but I haven't run into a scenario where I have to do that yet.
yum repolist
References:
https://access.redhat.com/solutions/23016
http://kb.kristianreese.com/?View=entry&EntryID=77
Subscribe to:
Posts (Atom)