Just a few useful ‘find’ examples
Exclude:
find . -path ./foo -prune -o -name bar
find /home \( -path /usr/data -prune -o -path /usr/src \) -prune -o -name foo -print
find . -name Makefile -not -path foo
find . -type d ! -regex .*\/\(foo\|bar\).* \;
Permissions:
find . -perm -775
find . -perm /u+w,g+
find . -printf "%m:%f\n"
find . -printf "%m %h/%f\n"|grep -v '^\(644\|755\)'
Print date:
find -type f -printf '%TF %.8TT %p\n'
Windows:
find.exe . -name *.exe -exec certutil -hashfile {} SHA512 ; >c:\hash.txt
Print modules:
python3 -c "import sys;print (sys.path)"
python3 -c "import sys;print (sys.modules)"
python3 -c "help('modules')"
python3 -c "help('modules package')"
pydoc3 modules
Packages:
- Location in Debian: /usr/lib/python{3}/dist-packages/pkgname/{__init__.py}
- Other distro’s use “site-packages”
pip3 install pkgname
pip3 uninstall pkgname
pip3 freeze
python3 -m pip install pkgname
python3
import pip
sorted(["%s==%s" % (i.key, i.version) for i in pip.get_installed_distributions()])
Virtualenv:
$ pip3 install virtualenv
$ mkdir workdir && cd workdir
$ virtualenv project
$ source project/bin/activate
$ pip3 install requests
(and/or git clone + python3 setup.py install / etc)
$ deactivate
$ rm -rf project
Strings:
Besides %
-format and str.format()
there’s now also f-Strings (since Python 3.6).
Example:
foo="value"
print(f'This string has a variable: {foo}.')
Notes:
- make sure your script.py does not have the same name as package
- print syntax changed from python2 to 3:
print ("foo")
List installed modules:
Pick one :)
perl -V
perldoc <module name>
perldoc perllocal
instmodsh
cpan -[l,a]
or:
perl -e 'use ExtUtils::Installed; foreach (ExtUtils::Installed->new()->modules()) {print $_ . "\n";}'
Install modules in homedir:
- install “local::lib” module
- print settings:
perl -Mlocal::lib
- add to .bashrc:
eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)"
Then there’s also “Perlbrew“.
BITS
Tool from Intel called “BIOS Implementation Test Suite”. Bootable (usb) image which can do several things including handling microcode:
Linux
load/update microcode using pkg:
Debian
- Intel:
apt install intel-microcode iucode-tool
- AMD:
apt install amd64-microcode
- Doc: /usr/share/doc/{intel,amd64}-microcode/README.Debian.gz
CentOS/RH
microcode_ctl
- https://git.centos.org/summary/rpms!microcode_ctl.git
load/update intel microcode manually:
- get latest tgz from intel: see below
- backup/copy files: /lib/firmware/intel-ucode
- check kernel config:
grep MICROCODE /boot/config-*
run iucode_tool:
/usr/sbin/iucode_tool -tb -lS /lib/firmware/intel-ucode/*
update initramfs:
update-initramfs -u -k all
reloading microcode:
echo 1 > /sys/devices/system/cpu/microcode/reload
or:
rmmod cpuid; modprobe cpuid
show version:
dmesg | grep microcode
grep microcode /proc/cpuinfo
skip loading microcode on boot:
- add to grub cmdline:
dis_ucode_ldr
Windows
Microsoft includes microcode updates in Windows for certain CPU’s. For example: KB4090007, KB3064209, KB2970215.
load/update microcode:
- using a VMWare driver called “cpumcupdate”: https://labs.vmware.com/flings/vmware-cpu-microcode-update-driver
show version:
- get hwinfo64 and goto “Central Processor(s)” > “Microcode Update Revision”
- or get “Read & Write Everything” (RWEverything) from http://rweverything.com
Get Microcode
Download the latest version from Intel:
https://downloadcenter.intel.com/download/27431/Linux-Processor-Microcode-Data-File?v=t.
How to create a 6to4 tunnel in Windows using CLI (for use with HE’s free Tunnel Broker service for example).
netsh interface teredo set state disabled netsh interface ipv6 add v6v4tunnel TunnelNamenetsh interface ipv6 add address TunnelName 2001:a:b:c::2 netsh interface ipv6 add route ::/0 TunnelName 2001:a:b:c::1
Where:
- “2001:a:b:c::” is your prefix
- “2001:a:b:c::1” is the gateway
- “2001:a:b:c::2” is your ipv6 address
Delete the tunnel:
netsh interface ipv6 delete address TunnelName 2001:a:b:c::2 netsh interface ipv6 delete route ::/0 TunnelName 2001:a:b:c::1 netsh interface ipv6 delete interface TunnelName
A HE tunnel can be requested here: https://tunnelbroker.net.
You must be logged in to post a comment.