Skip to content

Instantly share code, notes, and snippets.

@MaZderMind
MaZderMind / ConnectionHandler.java
Last active March 27, 2020 15:15
Example of a Nonblokcing Socket-Server with java.nio which reads Input Line-by-Line.
package de.mazdermind;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.SocketChannel;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder;
@MaZderMind
MaZderMind / java-nio-nonblocking-socket.java
Created April 21, 2019 19:13
Example of a Nonblokcing Socket-Server with java.nio
package de.mazdermind;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.util.Iterator;
@MaZderMind
MaZderMind / cpp_scope_guards.cpp
Created February 14, 2019 20:38
cpp_scope_guards.cpp
#include <iostream>
// https://github.com/ricab/scope_guard
#include "scope_guard.hpp"
int main (int argc, char** argv)
{
std::cout << "enter main" << std::endl;
std::cout << "open something" << std::endl;
#!/usr/bin/env python3
import logging
import sys
import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstNet', '1.0')
from gi.repository import Gst, GstNet, GObject
import sys
import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstNet', '1.0')
from gi.repository import Gst, GstNet
ptp_domain = 0
ptp_interfaces = ['enp0s25']
@MaZderMind
MaZderMind / carlmix.py
Created November 28, 2018 21:31
quick and dirty gstreamer videomixer, switching between 1 of 20 sources
#!/usr/bin/env python3
import logging
import random
import signal
import sys
import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstNet', '1.0')
@MaZderMind
MaZderMind / AnnotationUtil.java
Last active July 23, 2018 19:16
A Variant of the AuthenticationPrincipalArgumentResolver which injects an AuthenticationPrincipal merged into the correct EntityManager
package net.seibertmedia.team-rocket.someproject.configuration.mergedAuthenticationPrincipal;
import java.lang.annotation.Annotation;
import org.springframework.core.MethodParameter;
import org.springframework.core.annotation.AnnotationUtils;
public class AnnotationUtil {
private AnnotationUtil() {
}
@MaZderMind
MaZderMind / backup-github-locally.sh
Created June 4, 2018 14:01
backup-github-locally.sh
#!/bin/bash
set -xe
source /bulk/data/Drittsysteme/_env.sh
DIR="$BASEDIR/github"
NAMES_TMP=/tmp/github-repo-names.tmp
NAMES=/tmp/github-repo-names
PAGE=1
rm -f $NAMES
while true;
.ghx-issue-content {
position: relative;
}
.ghx-plan-extra-fields.ghx-row {
height: 0;
margin: 0
}
.ghx-plan-extra-fields .ghx-extra-field {
position: absolute;
top: 6px;
@MaZderMind
MaZderMind / 18-videos-hd.sh
Created March 7, 2018 21:31
18-videos-hd.sh
#!/bin/sh
gst-launch-1.0 \
videotestsrc pattern=ball foreground-color=0x00ff0000 ! video/x-raw,width=1920,height=1080,framerate=30/1,format=UYVY ! queue ! comp1. \
videotestsrc pattern=ball foreground-color=0x00ffff00 ! video/x-raw,width=1920,height=1080,framerate=30/1,format=UYVY ! queue ! comp1. \
videotestsrc pattern=ball foreground-color=0x0000ff00 ! video/x-raw,width=1920,height=1080,framerate=30/1,format=UYVY ! queue ! comp1. \
\
videotestsrc pattern=ball foreground-color=0x0000ffff ! video/x-raw,width=1920,height=1080,framerate=30/1,format=UYVY ! queue ! comp1. \
videotestsrc pattern=ball foreground-color=0x000000ff ! video/x-raw,width=1920,height=1080,framerate=30/1,format=UYVY ! queue ! comp1. \
videotestsrc pattern=ball foreground-color=0x00ff00ff ! video/x-raw,width=1920,height=1080,framerate=30/1,format=UYVY ! queue ! comp1. \
\