Note to self:
How to find the Raspberry Pi Model :
cat /proc/device-tree/model
Note to self:
How to find the Raspberry Pi Model :
cat /proc/device-tree/model
Saw this the other day, and I wanted to post it, so that I can remember it.
How to find a Raspberry Pi’s DHCP address:
arp -na | grep -i "b8:27:eb"
This is a NoteToSelf. Often I paste into VI/VIM, and the tabs go crazy and fly across the screen, leaving the text starting in the middle of the line. Then next line is even further! I can never remember how fix the issue.
To fix:
:set paste
I know I would loose this if I didn’t blog it.
With cURL, you can use “–data-urlencode” with query string params and a GET if you include the “-G” parameter. Of course you still have to escape things out, I just found it easer to add all the QueryString params separately. All the examples I could find were for POSTs.
FILTER="ReallyLongStringWIth"$VARS" SPACES and ' SINGLE quotes and a &" curl -s -G --header "authorization: Bearer $TOKEN" --data-urlencode "\$filter=$FILTER" --data-urlencode "api-version=2016-09-01" $URL
Whenever a certificate needs to be renewed, I always have to scramble to remember how to update/renew. I finally put a cheat sheet together.
I decided I will do all cert related stuff form Linux. Here are some commands:
To request a new csr with a new key:
openssl req -newkey rsa:2048 -keyout yourcompany.com.key -out yourcompany.com.csr Generating a 2048 bit RSA private key .............................................................................................+++ .............+++ writing new private key to 'stratgovadvisors.com' Enter PEM pass phrase: Verifying - Enter PEM pass phrase: ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]:US State or Province Name (full name) [Some-State]:New York Locality Name (eg, city) []:New York Organization Name (eg, company) [Internet Widgits Pty Ltd]:Your Company name Organizational Unit Name (eg, section) []:IT Common Name (e.g. server FQDN or YOUR name) []:*.yourcompany.com Email Address []: Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []:
To request a new csr with an existing key:
openssl req -new -key yourcompany.com.key -out yourcompany.com.csr
To make a PFX form a Private key and a cert:
openssl pkcs12 -export -out yourcompany.com.pfx -inkey yourcompany.com.key -in yourcompany.com.crt
To extract Private key and Cert from a PFX (3 steps)
Export the private key
openssl pkcs12 -in yourcompany.com.pfx -nocerts -out yourcompany.com.pem -nodes
Export the certificate
openssl pkcs12 -in yourcompany.com.pfx -nokeys -out yourcompany.com.crt
Remove the passphrase from the private key
openssl rsa -in yourcompany.com.pem -out yourcompany.com.key
Note to self.
When trying to filter a REST response in PowerShell, by using the “$filter” parameter in the url (as with MS CRM 2011), you must escape the “$” with “`$”.
For example:
Does not work:
$url=”http://crmserver.company.com/Organization/xrmservices/2011/OrganizationData.svc/ContactSet$filter=StateCode/Value eq 0″
Works:
$url=”http://crmserver.company.com/Organization/xrmservices/2011/OrganizationData.svc/ContactSet`$filter=StateCode/Value eq 0″
Gets me every time, and I can’t figure out why my filters are being ignored!
There are plenty of better documented examples out there, so this is more of a note to self.
cd /opt mkdir YourDir cd YourDir/ wget https://dl.eff.org/certbot-auto chmod a+x certbot-auto /certbot-auto --apache certonly -d www.FirstDomain.com -d FirstDomain.com -d www.SecondDoamin.com -d SecondDoamin.com -d www.ThirdDoamin.com -d ThirdDoamin.com -d www.FourthDomain.com -d FourthDomain.com
The name on the cert will be the first domain you list int he command above. All the other names will be part of the SAN cert.
And to renew, cron this up:
/opt/YourDir/certbot-auto renew
Sometimes I just want to look at the content of a config file and not all the descriptions.
grep -v "\#\|^[[:space:]]*$"
Note to self: When generating a CSR for Thawte: The State Name in the CSR cannot be abbreviated
Gets me every time.
I know this is everywhere, so this is more a note for myself. How to upload pictures to AD via PowerShell:
Import-RecipientDataProperty -Identity username -Picture -FileData ([Byte[]]$(Get-Content -Path .\username.jpeg -Encoding Byte -ReadCount 0))