Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianbiro committed Feb 4, 2024
1 parent 1871a9e commit 5aa327b
Show file tree
Hide file tree
Showing 14 changed files with 265 additions and 35 deletions.
7 changes: 5 additions & 2 deletions content/AWS/AWSLinksForDemo.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# AWS links for demo

## Ferrari use case

[Ferrari use case video](https://www.youtube.com/watch?v=1qYBEcG-fV4&list=WL&index=13&t=300s)

[Cognito user authentification](https://aws.amazon.com/cognito/)
Expand Down Expand Up @@ -34,7 +36,8 @@

[CloudWatch](https://aws.amazon.com/cloudwatch/)

## Generator prep.
## Generator prep

[Stored Procedures MySQL to Aurora](https://docs.aws.amazon.com/dms/latest/sql-server-to-aurora-mysql-migration-playbook/chap-sql-server-aurora-mysql.tsql.storedprocedures.html#chap-sql-server-aurora-mysql.tsql.storedprocedures.mysql)

[Periodically Start a State Machine Execution Using EventBridge](https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-cloudwatch-events-target.html) (At Mon. 00:30)
Expand All @@ -45,4 +48,4 @@ Upload report to O365

[Working with folders and files with REST](https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest)

[Send an email when a new item is created in a SharePoint list](https://learn.microsoft.com/en-us/sharepoint/dev/business-apps/power-automate/get-started/create-your-first-flow)
[Send an email when a new item is created in a SharePoint list](https://learn.microsoft.com/en-us/sharepoint/dev/business-apps/power-automate/get-started/create-your-first-flow)
3 changes: 2 additions & 1 deletion content/AWS/S3.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# S3

## Mount S3

```sh
$ vi /etc/passwd-s3fs
ACCESS_KEY_ID:SECRET_ACCESS_KEY
Expand All @@ -18,4 +19,4 @@ $ s3fs <s3_bucket_name> \
-o use_cache=/tmp -o allow_other -o uid=1000 \
-o mp_umask=002 -o multireq_max=5 \
-o url='https://s3-<aws_region>.amazonaws.com' /mnt/s3-bucket
```
```
2 changes: 2 additions & 0 deletions content/Blogs/RandomizeIMEIonBananaPhone.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ IMEI consists of 15 digits:

[Your Hardware Identifiers: Your IMEI and IMSI (and by extension, your phone number)](https://anonymousplanet.org/guide.html#your-imei-and-imsi-and-by-extension-your-phone-number)

[**(Do not work)** How to change IMEI on Snapdragon devices](https://gist.github.com/uragiristereo/7668e067e3b0525d6e4d4b12d9f71344)

**Zdroj je `Wilder`, ja som to len dal na kopu.**

[Randomize IMEI](https://wiki.lunardao.net/imei.html)
Expand Down
10 changes: 10 additions & 0 deletions content/Google/GoogleTips.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ GitHub,gh,https://github.com/search?q=%s&ref=opensearch
"Google Maps",gmaps,https://www.google.com/maps/search/%s?hl=en&source=opensearch
```

### Clear DNS cache

`chrome://net-internals/#dns`

### Change User Agent in Google Chrome

1. `CTR+Shift+I`
1. More Tools > Network Conditions. ...
1. Uncheck Select Automatically Checkbox.

## Search

Search for document
Expand Down
79 changes: 60 additions & 19 deletions content/Linux/PerformanceMonitoring.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# Performance Monitoring

## Usefull commands

```sh
$ dmesg --human --follow --ctime
dmesg --human --follow --ctime
```

```sh
iostat -xmdzh 1 # -p sda
# lsblk -l | awk '!(/loop/||/NAME/){print $1}'
```

```
CPU statistics and input/output statistics for devices and partitions
-x Display extended statistics.
Expand All @@ -16,49 +19,67 @@ CPU statistics and input/output statistics for devices and partitions
-z Omit output for any devices for which there was no activity during the sample period.
-h --human
```
#### Meminfo to MB

### Meminfo to MB

```sh
awk '{printf("%-20s %.2f MB\n", $1, ($2/1024))}' /proc/meminfo | sed 's/\.00//'
```
#### Processors related statistics

### Processors related statistics

```sh
mpstat -P ALL 1
```
#### Statistics for threads associated with selected tasks

### Statistics for threads associated with selected tasks

```sh
pidstat -t 1
```

```
Report statistics for Linux tasks.
-t Also display statistics for threads associated with selected tasks.
Report I/O statistics (kernels 2.6.20 and later only)
pidstat -d 1
```

```sh
pmap -x # pgrep <prog>
```

```
report memory map of a process
-x, --extended
less -S /proc/stat
```
#### ps

### ps

```sh
ps -ef f
ps -eo user,sz,rss,minflt,majflt,pcpu,args
```

cpu

```sh
ps -eo pcpu,pid,args | sort -k 1,1 -r
```

rss

```sh
ps -eo user,rss,pid,args | sort -r -n -k 2,2
```

threads

```
ps -eo nlwp,pid,args | sort -nr -k 1,1
```

```
Report a snapshot of the current processes.
-e Select all processes.
Expand All @@ -82,34 +103,45 @@ RSS is not an accurate measure of the total memory processes are consuming, beca
that were swapped out. On the other hand, the same shared libraries may be duplicated and counted in different processes.
However, RSS is a reliable estimate.
```
#### sar

### sar

```sh
sar -n DEV 1
```

```
Collect, report, or save system activity information.
-n { keyword[,...] | ALL }
Report network statistics.
With the DEV keyword, statistics from the network devices are reported.
```
#### Sort slabinfo to see what objects taking the most space [slabinfo(5)](https://man7.org/linux/man-pages/man5/slabinfo.5.html) [linux OOM](https://linux-mm.org/OOM)

### Sort slabinfo to see what objects taking the most space [slabinfo(5)](https://man7.org/linux/man-pages/man5/slabinfo.5.html) [linux OOM](https://linux-mm.org/OOM)

```sh
awk '{printf "%-30s %5d MB\n", $1 ,$3*$4/(1024*1024)}' < /proc/slabinfo | sort -nr -k2
```
#### smem

### smem

```sh
smem -s swap -r | awk 'NR==1{print; next};int($4) > 0'
```

```
Report memory usage with shared memory divided proportionally.
-s SORT, --sort=SORT
-r, --reverse
AWK print header and non-zero swap usage
```
#### Top one program show individual threads

### Top one program show individual threads

```sh
top -b -d 1 -p "$(pgrep "${1}" | head -1)" -H
```
```

```
-b Batch-mode operation
-d Delay-time interval between screen updates
Expand All @@ -118,10 +150,13 @@ top -b -d 1 -p "$(pgrep "${1}" | head -1)" -H
Instructs top to display individual threads. Without this command-line option a summation of all threads in each
process is shown. Later this can be changed with the `H' interactive command.
```
#### vmstat

### vmstat

```sh
vmstat -Sm 1
```

```
Report virtual memory statistics
-S, --unit character
Expand All @@ -130,10 +165,12 @@ Report virtual memory statistics
-m, --slabs
Displays slabinfo.
```
#### Core freq [cpuinfo flags](https://www.baeldung.com/linux/proc-cpuinfo-flags)

### Core freq [cpuinfo flags](https://www.baeldung.com/linux/proc-cpuinfo-flags)

```sh
awk '
BEGIN { FS = ":" }
BEGIN { FS = ":" }
$1 ~ /^processor[[:space:]]+$/ { Processor = $2 }
Expand All @@ -143,20 +180,23 @@ END { for (Processor in Cores) { printf("CORE_%d: %d\n", Processor + 1, Cores[Pr
}' /proc/cpuinfo

```
#### Cpu temperature

### Cpu temperature

```sh

find /sys/class/thermal/thermal_zone*/ -maxdepth 0 -print0 | while IFS= read -r -d '' dir; do
echo "$(cat "${dir}"/type): $(sed 's/\(.\)..$/.\1°C/' "${dir}/temp")"
done
```
temp stores 54000 millidegree Celsius, that means 54°C
https://www.kernel.org/doc/Documentation/thermal/x86_pkg_temperature_thermal
https://www.kernel.org/doc/Documentation/thermal/sysfs-api.txt

temp stores 54000 millidegree Celsius, that means 54°C
<https://www.kernel.org/doc/Documentation/thermal/x86_pkg_temperature_thermal>
<https://www.kernel.org/doc/Documentation/thermal/sysfs-api.txt>

----
----

## Linux Performance Monitoring Primer

[Linux Performance Monitoring Tools - YouTube](https://www.youtube.com/watch?v=2OsTSD5z1SU)
Expand Down Expand Up @@ -188,7 +228,8 @@ https://www.kernel.org/doc/Documentation/thermal/sysfs-api.txt
[Difference Between Resident Set Size and Virtual Memory Size](https://www.baeldung.com/linux/resident-set-vs-virtual-memory-size)

[Prstat on Linux with Top](http://javaeesupportpatterns.blogspot.com/2012/02/prstat-linux-how-to-pinpoint-high-cpu.html)
## Tools

## Tools

### Flame Graphs

Expand Down Expand Up @@ -242,4 +283,4 @@ https://www.kernel.org/doc/Documentation/thermal/sysfs-api.txt

[BPF - the forgotten bytecode cloudflare](https://blog.cloudflare.com/bpf-the-forgotten-bytecode/)

[bpf-helpers(7)](https://www.man7.org/linux/man-pages/man7/bpf-helpers.7.html)
[bpf-helpers(7)](https://www.man7.org/linux/man-pages/man7/bpf-helpers.7.html)
2 changes: 2 additions & 0 deletions content/Networking/DNSStuff.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ sudo killall -USR1 systemd-resolved
sudo killall -HUP dnsmasq
```

In *Google Chrome* `chrome://net-internals/#dns` in *Mozilla Firefox* `about:networking#dns`

## PGP and DNS

[PGP and DNS](https://slxh.nl/blog/2016/pgp-and-dns/)
Expand Down
17 changes: 17 additions & 0 deletions content/Powershell/MiscelaneusTips.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,20 @@ Similar to the python [inspect](https://docs.python.org/3/library/inspect.html)
```powershell
Get-ChildItem -Path '.' -Recurse -Include '*.ps1','*.psm1','*.psd1' | Unblock-File -Verbose
```

## Enable Debug or Verbose output

```powershell
PS /home/adrian> function foo {
[CmdletBinding()]
Param([parameter(ValueFromRemainingArguments=$true)][String[]] $args)
Write-Verbose 'VVVVVVV'
Write-Debug 'DDDDDDD'
Write-Host "host"
}
PS /home/adrian> foo -Debug -Verbose
VERBOSE: VVVVVVV
DEBUG: DDDDDDD
host
PS /home/adrian>
```
Loading

0 comments on commit 5aa327b

Please sign in to comment.