Skip to content

Instantly share code, notes, and snippets.

View aschwinwester's full-sized avatar

aschwinwester

View GitHub Profile
@aschwinwester
aschwinwester / view-server-certificate.md
Last active May 8, 2020 08:11
view server certificate

Goal is to download and convert certificate of a server, example.com

openssl s_client -showcerts -connect example.com:443 -servername example.com </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > example.com.pem

convert PEM to CER file

find IP address of router

netstat -nr | grep default

output might be

default            192.168.40.1       UGSc          231        0     en0       
default fe80::%utun0 UGcI utun0 
@aschwinwester
aschwinwester / flash-rasbian-sd-card-macos.md
Last active April 19, 2020 18:17
flash rasbian lite to SD card on MacOS

Steps flashing OS

I will do some optional preparation, download OS and flash OS to memory SD card. Just for fun, I will try to do much as possible from the command line.

Optional prerequisite 1: HomeBrew

We want HomeBrew as is helps us with installing many items using CLI

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
@aschwinwester
aschwinwester / mount_qnap.md
Last active February 29, 2020 20:05
mount qnap from MacOS and GNU/Linux QNAP OS

Showing several mounting commands

The following mounting options work on my several devices.

mount recent QNAP device from MacOS

sudo mount -t nfs -o rw,bg,hard,resvport,intr,noac,nfc,tcp,nfsv3 192.168.x.x:/Public /Volumes/Data/qnap

mount older QNAP device from MacOS

@aschwinwester
aschwinwester / python-install-certificates.md
Created November 7, 2018 17:17
Install certificates form python on MacOS

check Python version first

ls -ld /Applications/Python*

output might be something like:

drwxr-xr-x@ 10 root  wheel  320 Oct 27  2017 /Applications/Python 3.6
drwxr-xr-x@ 10 root  wheel  320 Nov  7 06:46 /Applications/Python 3.7

run command with version (latest) to use

screen ~/Library/Containers/com.docker.docker/Data/vms/0/tty
@aschwinwester
aschwinwester / karma-phantomjs-not-working.md
Created October 10, 2018 14:01
Path must be a string. Received null
WARN [plugin]: Error during loading "karma-phantomjs-launcher" plugin:
  Path must be a string. Received null
...

WARN [launcher]: Can not load "PhantomJS", it is not registered!
  Perhaps you are missing some plugin?

I have installed in node_modules the following:

@aschwinwester
aschwinwester / sed-ungreedy-regex.md
Last active October 9, 2018 07:29
Example ungreedy regex in sed

Cleaning JSON file

{"description":"OK","responseSchema":{"$ref":"#/definitions/CreditTransfers"},"schema":{"$ref":"#/definitions/CreditTransfers"}},

remove json part from swagger.json file remove the following part

"responseSchema":{"$ref":"#/definitions/Error"},
umake ide idea-ultimate
@aschwinwester
aschwinwester / pyopenssl-error.md
Last active October 2, 2018 08:32
python openssl issue using virtualenv

Python virtual env open ssl error

I am using virtualenv, but noticed that python 2.7 gave an error on pyopenssl outside virtualenv. My company uses an intermediate ssl certificate. My solution of the ssl error was to add that certificate to all pip.conf, outside and inside virtualenv.

 File "/usr/local/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/usr/local/lib/python2.7/site-packages/OpenSSL/SSL.py", line 118, in <module>
    SSL_ST_INIT = _lib.SSL_ST_INIT
AttributeError: 'module' object has no attribute 'SSL_ST_INIT'