Skip to content

Instantly share code, notes, and snippets.

@nutrino
nutrino / macos_dmg_install.md
Last active February 12, 2023 13:50
macOS dmg install via command (specific destination disk enabler)
  1. Mount .dmg file (dbl-click)

  2. Open Terminal.

cd /Volumes/Samsung\ DeX

sudo installer -verboseR -dumplog -pkg Install\ Samsung\ DeX.pkg -target /

  1. Reboot
#!/bin/sh
if [ -z "$1" ]; then
echo "list_old_files.sh [files_to_find]"
exit 1
fi
set -x #echo on
## remove files older than specific date
@nutrino
nutrino / dotnet_commands.sh
Created February 1, 2023 00:38
.NET Commands in Linux
dotnet nuget locals all -l
@nutrino
nutrino / exif_set_date.py
Last active January 17, 2023 15:43
set image file date from exif data
#!/usr/bin/env python
# https://gist.github.com/ikoblik/7089165
"""A simple utility to restore file creation and modification
dates back to their original values from EXIF.
This script requires exif module to be installed or the exif
command line utility to be in the path.
NODE_OPTIONS=--max_old_space_size=8192 npm install
@nutrino
nutrino / linux_useful_scripts.sh
Last active May 8, 2023 14:28
Linux useful scripts
# https://news.hada.io/topic?id=7286
alias df='df -h -x tmpfs -x devtmpfs -x squashfs'
alias xc='xclip -sel clipboard'
alias ttfb='curl -so /dev/null -w "HTTP %{http_version} %{http_code} Remote IP: %{remote_ip}\nConnect: %{time_connect}\nTTFB: %{time_starttransfer}\nTotal time: %{time_total}\nDownload speed: %{speed_download}bps\nBytes: %{size_download}\n"'
ap() {
https $@ Accept:application/activity+json
}
shodan() {
grub > recovery mode > login as root
fsck -f /dev/sdXX
Ctrl+Alt+F1 (tty1) > login as user
sudo sytstemctl isolate graphical
(make default on boot)
sudo systemctl set-default graphical.target
@nutrino
nutrino / show_process_by_port.md
Created August 29, 2022 01:06
Windows Show Process by Port

https://stackoverflow.com/a/48199

#TCP (powershell)

Get-Process -Id (Get-NetTCPConnection -LocalPort YourPortNumberHere).OwningProcess #UDP (powershell) Get-Process -Id (Get-NetUDPEndpoint -LocalPort YourPortNumberHere).OwningProcess

#cmd C:\> netstat -a -b (Add -n to stop it trying to resolve hostnames, which will make it a lot faster.)

@nutrino
nutrino / prevent_unmount.sh
Created May 13, 2022 15:45
macOS prevent from accidental unmounting
#!/bin/bash
# https://stackoverflow.com/a/23716566
screen -D -RR test1 -X quit || true
screen -dmS test1
screen -r test1 -p 0 -X stuff $"cd /Volumes/SDUltra ^M"