Skip to content

Instantly share code, notes, and snippets.

View samir-plusb's full-sized avatar
🏠
Working from home

Samir Rachidi samir-plusb

🏠
Working from home
View GitHub Profile
@samir-plusb
samir-plusb / Dockerfile
Created August 17, 2021 12:14 — forked from shyd/Dockerfile
install locales inside a docker image
FROM debian
RUN apt-get update && \
apt-get install -y \
locales && \
rm -r /var/lib/apt/lists/*
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
sed -i -e 's/# de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales
@samir-plusb
samir-plusb / ovpn-writer.sh
Created February 15, 2021 16:00 — forked from renatolfc/ovpn-writer.sh
Script to generate an OpenVPN client configuration file in the unified format
#!/bin/sh
##
## Usage: ./ovpn-writer.sh SERVER CA_CERT CLIENT_CERT CLIENT_KEY SHARED_SECRET > client.ovpn
##
server=${1?"The server address is required"}
cacert=${2?"The path to the ca certificate file is required"}
client_cert=${3?"The path to the client certificate file is required"}
client_key=${4?"The path to the client private key file is required"}
@samir-plusb
samir-plusb / self-signed-certificate-with-custom-ca.md
Created February 10, 2021 16:46 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@samir-plusb
samir-plusb / how-to-add-image-to-gist.md
Created January 17, 2021 18:49 — forked from mroderick/how-to-add-image-to-gist.md
How to add an image to a gist

How to add an image to a gist

  1. Create a gist if you haven't already.
  2. Clone your gist:
    # make sure to replace `<hash>` with your gist's hash
    git clone https://gist.github.com/<hash>.git # with https
    git clone [email protected]:<hash>.git     # or with ssh
@samir-plusb
samir-plusb / gist:7cac60a7842a0ddce07268d857e9ebe8
Created October 13, 2020 15:11 — forked from davisford/gist:5039064
git clone into non-empty directory

Let's say you start a project locally, and do some editing.

$ mkdir -p ~/git/foo && cd ~/git/foo
$ touch NEWFILE

Now you decide you want to create a new github repo and track it, but the directory is non-empty so git won't let you clone into it. You can fix this, thusly:

from here: https://legacy.thomas-leister.de/apache-reverse-proxy-mit-ssl-support-einrichten/
SSLProxyEngine On
ProxyPass / https://mypage.com/en/category/blog/
ProxyPassReverse / https://mypage.com/en/category/blog/
@samir-plusb
samir-plusb / README.md
Created June 2, 2020 16:42 — forked from cedricziel/README.md
TYPO3 Extension with 3rd part composer dependencies. composer.json is placed in Resources/Private - Updated

Motivation

As long as composer support in CMS is "not there yet", you need to get around somehow.

Say you want to use the (awesome) markdown library, you need a way to get it in.

How

  1. Use a container extension with a private namespace

Loading variables from .env files in Ansible

Ansible has various ways of looking up data from outside sources, including plain text password files, CSV files and INI files. But it doesn't seem to have a lookup for .env files, as used in Laravel projects, also available for PHP, Ruby, Node.js, Python and others.

One option is to launch Ansible with the Ruby dotenv command line script... But that requires Ruby, which seems like overkill to me.

So here is a simpler solution that I use. It consists of:

  1. The .env file itself
  2. A small shell script that loads the .env file into environment variables - ansible-playbook.sh
@samir-plusb
samir-plusb / kill_child_processes.py
Created December 7, 2018 03:27 — forked from jizhilong/kill_child_processes.py
how to kill a process's child processes in python
#!/usr/bin/env python
import multiprocessing
import time
import subprocess, os, signal, sys
def test(s):
while True:
print s
time.sleep(1.5)