Skip to content

Instantly share code, notes, and snippets.

🎯
focused

Sören Martius soerenmartius

🎯
focused
Block or report user

Report or block soerenmartius

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View processes-vs-threads.csv
Process Thread
Processes are heavy-weight operations. Threads are lighter-weight operations.
Processes can start new processes using e.g. [fork()](http://man7.org/linux/man-pages/man2/fork.2.html) (system call). A process can start several threads using e.g [pthread_create()](http://man7.org/linux/man-pages/man3/pthread_create.3.html) (system call).
Each process lives in its own memory (address) space and holds a full copy of the program in memory which consume more memory. Processes don’t share memory with other processes. Threads share memory with other threads of the same process. Threads within the same process live within the same address space and can thus easily access each other's data structures. The shared memory heaps and pools allow for reduced overhead of shared components.
Inter-process communication is slow as processes have different memory addresses. Inter-thread communication can be faster than inter-process communication because threads of the same process share memory with the process they
@soerenmartius
soerenmartius / multi_processing.py
Created May 5, 2020
Multiprocessing Example in Python3
View multi_processing.py
import multiprocessing
def spawn_process(number):
print(f'Runs in separate process {number}')
if __name__ == '__main__':
max_processes = 5
@soerenmartius
soerenmartius / multithreading.go
Created May 5, 2020
Multithreading Example with WaitGroups in Golang
View multithreading.go
package main
import (
"fmt"
"sync"
"time"
)
func worker(wg *sync.WaitGroup, id int) {
defer wg.Done()
@soerenmartius
soerenmartius / repository.tf
Last active Mar 29, 2020
GitHub Repository with Branch Protection Rule
View repository.tf
module "iac-github" {
source = "mineiros-io/repository/github"
version = "~> 0.1.0"
name = "iac-github"
private = true
description = "An example on how to manage a GitHub organization with Terraform."
allow_merge_commit = true
@soerenmartius
soerenmartius / deploy.yml
Last active Mar 29, 2020
SemaphoreCI Terraform Deployment Pipeline.
View deploy.yml
version: v1.0
name: "Deploy to GitHub"
agent:
machine:
type: e1-standard-2
os_image: ubuntu1804
global_job_config:
env_vars:
- name: BUILD_TOOLS_VERSION
@soerenmartius
soerenmartius / semaphore.yml
Created Mar 29, 2020
SemaphoreCI Pipeline Configuration
View semaphore.yml
version: v1.0
name: "IaC-Github CI Pipeline"
agent:
machine:
type: e1-standard-2
os_image: ubuntu1804
global_job_config:
env_vars:
- name: BUILD_TOOLS_VERSION
@soerenmartius
soerenmartius / repository.tf
Created Mar 29, 2020
Create new GitHub Repository with Terraform
View repository.tf
module "iac-github" {
source = "mineiros-io/repository/github"
version = "~>0.1.0"
name = "iac-github"
private = true
description = "An example on how to manage a GitHub organization with Terraform."
allow_merge_commit = true
@soerenmartius
soerenmartius / Makefile
Created Mar 29, 2020
Makefile with Terraform targets
View Makefile
SHELL := /bin/bash
MOUNT_TARGET_DIRECTORY = /app/src
BUILD_TOOLS_DOCKER_REPO = mineiros/build-tools
# Set default value for environment variable if there aren't set already
ifndef BUILD_TOOLS_VERSION
BUILD_TOOLS_VERSION := latest
endif
@soerenmartius
soerenmartius / provider.tf
Created Mar 29, 2020
Terraform with S3 Remote State and DynamoDB State Locks
View provider.tf
# ---------------------------------------------------------------------------------------------------------------------
# SET TERRAFORM AND PROVIDER REQUIREMENTS
# ---------------------------------------------------------------------------------------------------------------------
terraform {
required_version = "~> 0.12.24"
backend "s3" {
bucket = "github-terraform-example-terraform-state"
key = "organization/github-terraform-example/terraform.tfstate"
@soerenmartius
soerenmartius / provider.tf
Created Mar 29, 2020
Terraform provider without s3 and state locks
View provider.tf
# ---------------------------------------------------------------------------------------------------------------------
# SET TERRAFORM AND PROVIDER REQUIREMENTS
# ---------------------------------------------------------------------------------------------------------------------
terraform {
required_version = "~> 0.12.24"
required_providers {
aws = "~> 2.4"
}
You can’t perform that action at this time.