Some snippets that make my life easier.
I’m creating this post mostly for myself so I don’t have to remember all the specifics.
cUrl a SOAP service:
curl "https://www.example.com/Service.svc" -H "SOAPAction: ""urn:service.example.com/IService/PresentationGet""" --data-binary @post.txt --comcodessed -k -D responseHeaders.txt -v -o response.txt
(optional headers)
-H "Pragma: no-cache" -H "Accept-Encoding: gzip, deflate" -H "Content-Type: text/xml; charset=UTF-8" -H "Accept: application/xml, text/xml, */*; q=0.01" -H "Cache-Control: no-cache"
*nix / Mac
delete a folder with contents ((i) be aware of rm -rf dangers as per Wikipedia)
rm -rf [folder]
Create a “soft” symbolic link to a folder:
ln -s /path/to/original/ /path/to/link
Simple Python3 based http server in the current folder:
python -m http.server 8000
The same as above with Python 2:
python -m SimpleHTTPServer 8000
Find the process afterwards:
ps -fA | grep python
OpenSSL encrypt / decrypt:
openssl des3 -in file.txt -out encrypted.txt openssl des3 -d -in encrypted.txt -out normal.txt
File character garbage cleanup:
tr -cd '\11\12\15\40-\176' 'original.csv' 'cleaned.csv'
Start Apache
sudo apachectl start
Zip with password
zip -er archive.zip *.*
Tasks:
jobs -l
kill 861
kill `jobs -p`
Switch to stopped task:
fg [%n]
Powershell
curl like
Invoke-WebRequest https://www.example.com/hello-world.html http://proxy.int:8080 -TimeoutSec 10
(New-Object System.Net.WebClient).DownloadString(“http://www.example.com/hello-world.html”)
create guid
[guid]::NewGuid()
touch
(ls testFile.txt).LastWriteTime = Get-Date
Windows
echo %USERPROFILE%
%ALLUSERSPROFILE% %APPDATA% %CD% (current folder) %DATE% %COMPUTERNAME% %CMDEXTVERSION% %RANDOM% %TIME% %USERDOMAIN% %USERNAME% %USERPROFILE% %WINDIR%
Excel
Placing
sep=<delimiter>
as the first line of a csv file will automatically tell Excel to use that character as the separator instead of the default comma.
Other
nslookup www.bjelic.net 8.8.8.8