Skip to content

Instantly share code, notes, and snippets.

View abramovk's full-sized avatar
🏠
Working from home

Kirill Abramov abramovk

🏠
Working from home
View GitHub Profile
@abramovk
abramovk / clear.sh
Created December 2, 2023 11:59
Delete files *.txt older than 6 days
#!/bin/sh
find /data/*.txt -mtime +6 -type f -delete
@abramovk
abramovk / stat.sh
Created December 2, 2023 11:55
CPU usage
#!/bin/sh
grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage "%"}'
@abramovk
abramovk / swap.sh
Created December 2, 2023 11:53
Clean swap
#!/bin/sh
echo 3 > /proc/sys/vm/drop_caches && swapoff -a && swapon -a
@abramovk
abramovk / datetime.sh
Last active December 2, 2023 11:56
Update datetime from google
#!/bin/sh
httpdate="$(wget --no-cache -S -O /dev/null google.com 2>&1 |
sed -n -e 's/ *Date: *//p' -eT -eq)"
[ -n "$httpdate" ] && date -s "$httpdate"
@abramovk
abramovk / sync.ps1
Last active December 2, 2023 11:56
Update git repos recursively (windows)
Get-ChildItem -Directory -Force -Recurse *.git | ForEach-Object { cd $_.Parent.FullName; Write-Host $_.Parent.FullName; git fetch --all; git pull --all }