IT notes

odroid C2

Disabling blinking blue led: echo none > /sys/class/leds/blue:heartbeat/trigger To make the change permanent add the line to /etc/rc.local

exec

exec is a functionality of an operating system that runs an executable file in the context of an already existing process, replacing the previous executable. https://en.wikipedia.org/wiki/Exec_(system_call) exec replaces the current program in the current process, without forking a new process. Examples to use: exec csh This will just replace the existing shell with csh and only need to type exit once Within a script to startup python scripts, for example:

sockstat

The sockstat command list open Internet or UNIX domain sockets. List open tcp in ipv4: # sockstat -4l Show connectd sockets in port 443 and tcp: # sockstat -P tcp -p 443 -c List unix sockets: # sockstat -u

Ansible ad-hoc

To send a command to all the servers within a playbook: $ ansible all -a "service chronyd restart" -u devops --become What’s an ad-hoc command? An ad-hoc command is something that you might type in to do something really quick, but don’t want to save for later. http://docs.ansible.com/ansible/latest/user_guide/intro_adhoc.html

freebsd-update

Update Freebsd using freebsd-update: Set in /etc/rc.conf: kern_securelevel_enable="NO" kern_securelevel="0" reboot and then: # freebsd-update upgrade -r 10.4-RELEASE # freebsd-update install # reboot # freebsd-update install Repeate then to upgrade to 11.1 freebsd-update upgrade -r 11.1-RELEASE Only security patches: # freebsd-update fetch # freebsd-update install To update the packages: # pkg-static upgrade -f # freebsd-update install A forced upgrade of all installed packages will replace the packages with fresh versions from the repository even if the version number has not increased.

Influxdb

Basic influxdb queries, setup. You can use influx (the influxdb shell) or use the http API on port :8086 Create and apply retention policy to a database: warning this may remove/purge existing data CREATE RETENTION POLICY "30_days" ON collectd DURATION 30d REPLICATION 1 default notice the ending default that means to apply the created policy Show retention policies: > show retention policies name duration shardGroupDuration replicaN default ---- -------- ------------------ -------- ------- autogen 0s 168h0m0s 1 false 30_days 720h0m0s 24h0m0s 1 true Show databases contents (measurements):

womp

To enable WoL (Wake-on-LAN) on macOS: $ sudo pmset womp 1 Then check the settings: $ pmset -g System-wide power settings: Currently in use: standbydelay 10800 standby 1 womp 1 halfdim 1 hibernatefile /var/vm/sleepimage powernap 1 gpuswitch 2 networkoversleep 0 disksleep 10 sleep 1 (sleep prevented by coreaudiod, coreaudiod, iTunes) autopoweroffdelay 28800 hibernatemode 3 autopoweroff 1 ttyskeepawake 1 displaysleep 10 tcpkeepalive 1 acwake 0 lidwake 1

Domain Fronting

If your domain becomes blocked you “could use” another one to bypass the block: curl -s -H "Host: your-blocked-domain" -H "Connection: close" "https://new-tld/your/path" Both domains must be hosted within the same CDN, example: curl -s -H "Host: images-na.ssl-images-amazon.com" -H "Connection: close" "https://cdn.atlassian.com/images/I/01rgQ3jqo7L.css" More info: https://www.optiv.com/blog/escape-and-evasion-egressing-restricted-networks https://www.peew.pw/blog/2018/2/22/how-i-identified-93k-domain-frontable-cloudfront-domains

IDNA

To encode/decode a domain using “Internationalized Domain Names” $ python >>> x = u'qép.com' >>> x.encode('idna') b'xn--qp-bja.com' >>> x.encode('idna').decode('idna') 'qép.com' >>> x == x.encode('idna').decode('idna') True To prevent non-international domain names containing hyphens from being accidentally interpreted as Punycode, international domain name Punycode sequences have a so-called ASCII Compatible Encoding (ACE) prefix, “xn–”, prepended.[2] Thus the domain name “bücher.tld” would be represented in ASCII as “xn–bcher-kva.tld”.

Find Windows Product Key

To retrive the windows product key you can run this within a windows power shell: PS C:\Users\Monkey> (Get-WmiObject -query 'select * from SoftwareLicensingService').OA3xOriginalProductKey xxxxx-xxxxx-xxxxx-xxxxx-xxxxx