Skip to content

Instantly share code, notes, and snippets.

View danielprinz's full-sized avatar
📆

Daniel Prinz danielprinz

📆
View GitHub Profile
"""Event emitter playground"""
import asyncio
import logging
import pytest
from pyee import AsyncIOEventEmitter
LOG = logging.getLogger(__name__)
@pytest.mark.asyncio
@danielprinz
danielprinz / AWSRequestSigningInterceptor.java
Last active February 28, 2024 23:18
Request Signing Interceptor adapted for AWS SDK v2
import static org.apache.http.protocol.HttpCoreContext.HTTP_TARGET_HOST;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
@danielprinz
danielprinz / moving-files-with-history-git
Created October 24, 2018 10:40
Moving files with history from one git repo to another
# http://gbayer.com/development/moving-files-from-one-git-repository-to-another-preserving-history/
# Get files ready to move
git clone <git repo A>
cd <git repo A directory>
git remote rm origin
git filter-branch --subdirectory-filter <directory 1> -- --all
mkdir <directory 1>
mv * <directory 1>
git add .
@danielprinz
danielprinz / introrx.md
Created August 16, 2018 13:49 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@danielprinz
danielprinz / delete_git_submodule.md
Created July 19, 2018 09:55 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
#!/bin/bash
# Delete all stopped containers
docker ps -q -f status=exited | xargs --no-run-if-empty docker rm
# Delete all dangling (unused) images
docker images -q -f dangling=true | xargs --no-run-if-empty docker rmi
variables:
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
cache:
paths:
- .m2/repository
.validate: &validate
stage: build
void setHeight(int arg) {
height = arg;
}
void setWidth(int arg) {
width = arg;
}
void setValue(String name, int value) {
if (name.equals("height")) {
height = value;
return;
}
if (name.equals("width")) {
width = value;
return;
}
}
public void findPrimeNumbers() {
List<Integer> primeNumbers = IntStream
.rangeClosed(1, 100)
.filter(this::isPrime)
.boxed()
.collect(Collectors.toList());
System.out.println(primeNumbers.toString());
}