Skip to content

Instantly share code, notes, and snippets.

View misterjoa's full-sized avatar
🤓

Joachim Kruithof misterjoa

🤓
View GitHub Profile
@misterjoa
misterjoa / gen-key-script
Created December 16, 2020 17:57 — forked from woods/gen-key-script
Creating gpg keys non-interactively
Key-Type: 1
Key-Length: 2048
Subkey-Type: 1
Subkey-Length: 2048
Name-Real: Root Superuser
Name-Email: [email protected]
Expire-Date: 0
@misterjoa
misterjoa / README.md
Created September 28, 2020 15:45 — forked from mosquito/README.md
Add doker-compose as a systemd unit

Docker compose as a systemd unit

Create file /etc/systemd/system/[email protected]. SystemD calling binaries using an absolute path. In my case is prefixed by /usr/local/bin, you should use paths specific for your environment.

[Unit]
Description=%i service with docker compose
Requires=docker.service
After=docker.service
@misterjoa
misterjoa / multiple-deploy-keys-multiple-private-repos-github-ssh-config.md How to configure multiple deploy keys for different private github repositories on the same computer

This is probably a common issue for people who wants to deploy serveral repository on one VPS or VM.

This is not going to be rocket science.

The first step is to generate your first ssh key, for this type the following command line in your terminal: ssh-keygen -t rsa -b 4096 -C "[email protected]" When the command CLI is asking you if you want to use a passphrase you might want to press ENTER in order to don't have to type it everytime you will want to pull your repository.

Now copy the content of your public key and add it to Github in your first repository (Settings > Deploy keys). For example on debian it might be:

@misterjoa
misterjoa / py-comp-to-js.md
Created September 22, 2020 16:22 — forked from dschep/py-comp-to-js.md
Python Comprehensions to JS

Python list & dict comprehensions translated to JavasScript

Comprehensions are a really useful feature of Python that aren't available in JavaScript (or many languages). These concepts of course can be tranlsated into using map instead. But especially the dictionaries are a bit trickier.

Lists / Arrays

This one is easy as they translate very simply to map.

>>> foobar = range(5)
>>> [x + 1 for x in foobar]
@misterjoa
misterjoa / gist:20847f6311417688a2a16a6f9dc10b2f
Created September 17, 2020 12:03 — forked from yuezhu/gist:47b15b4b8e944221861ccf7d7f5868f5
Generate self-signed certificate for HAProxy
# Generate a unique private key (KEY)
sudo openssl genrsa -out mydomain.key 2048
# Generating a Certificate Signing Request (CSR)
sudo openssl req -new -key mydomain.key -out mydomain.csr
# Creating a Self-Signed Certificate (CRT)
openssl x509 -req -days 365 -in mydomain.csr -signkey mydomain.key -out mydomain.crt
# Append KEY and CRT to mydomain.pem
@misterjoa
misterjoa / bytesto.py
Created July 8, 2020 10:06 — forked from shawnbutts/bytesto.py
bytes to to mb, gb, etc in python
def bytesto(bytes, to, bsize=1024):
"""convert bytes to megabytes, etc.
sample code:
print('mb= ' + str(bytesto(314575262000000, 'm')))
sample output:
mb= 300002347.946
"""
a = {'k' : 1, 'm': 2, 'g' : 3, 't' : 4, 'p' : 5, 'e' : 6 }
@misterjoa
misterjoa / autoreload.md
Created June 24, 2020 08:59 — forked from deehzee/autoreload.md
Auto reload of modules in jupyter notebook

Module autoreload

To auto-reload modules in jupyter notebook (so that changes in files *.py doesn't require manual reloading):

# for auto-reloading external modules
# see http://stackoverflow.com/questions/1907993/autoreload-of-modules-in-ipython
%load_ext autoreload
%autoreload 2
@misterjoa
misterjoa / install-docker.md
Created June 12, 2020 13:50 — forked from npearce/install-docker.md
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
@misterjoa
misterjoa / list_queues.txt
Created April 23, 2020 13:41 — forked from oubiwann/list_queues.txt
A Kombu send/receive example
Listing queues ...
hipri 5
lopri 0
midpri 0
...done.
@misterjoa
misterjoa / Pipfile
Last active December 4, 2019 15:37 — forked from dankrause/ipc.py
Simple socket IPC in python
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
docopt = "*"