Skip to content

Instantly share code, notes, and snippets.

View EliasRanz's full-sized avatar

Elias Ranz-Schleifer EliasRanz

View GitHub Profile
@EliasRanz
EliasRanz / dark-theme.css
Last active April 17, 2018 13:28
My slack dark theme
/* modified version of https://github.com/widget-/slack-black-theme/ */
:root {
/* Modify these to change your theme colors: */
--primary: #09F;
--text: #FFF;
--background: #111;
--background-elevated: #222;
/* These should be less important: */
@EliasRanz
EliasRanz / gist:3e661d4e077cb24cf99f808f0287c0b3
Last active December 20, 2018 11:20
Minecraft server start
#! /bin/bash
# Some requirements
## Screen
## inotify (inotifywait)
######################CONFIG SECTION###########################################
#
##Path to the FTB jar file with no trailing slash /
server_path="/home/minecraft"
@EliasRanz
EliasRanz / LinkUtil.java
Last active January 2, 2019 21:50
Link Utility that allows you to extract urls from a given text of string. Utilized by my Twitch moderator bot.
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class LinkUtil {
public static List<String> extractUrls(String text) {
List<String> containedUrls = new ArrayList<>();
Pattern urlPattern = Pattern.compile(
"(?:(?:https?|ftp):\\/\\/)?(?:\\S+(?::\\S*)?@)?(?:(?!10(?:\\.\\d{1,3}){3})(?!127(?:\\.\\d{1,3}){3})(?!169\\.254(?:\\.\\d{1,3}){2})(?!192\\.168(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\x{00a1}-\\x{ffff}0-9]+-?)*[a-z\\x{00a1}-\\x{ffff}0-9]+)(?:\\.(?:[a-z\\x{00a1}-\\x{ffff}0-9]+-?)*[a-z\\x{00a1}-\\x{ffff}0-9]+)*(?:\\.(?:[a-z\\x{00a1}-\\x{ffff}]{2,})))(?::\\d{2,5})?(?:\\/[^\\s]*)?",
@EliasRanz
EliasRanz / StringUtil.java
Last active January 3, 2019 15:19
String Utility that handles common String operations such as checking against character spam, and ascii art for Twitch moderation.
import org.apache.commons.lang3.StringUtils;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class StringUtil {
private static Integer spamCharCount = 10;
public static boolean containsAscii(String text) {
@EliasRanz
EliasRanz / MongoConfig.java
Last active June 12, 2024 19:48
Mongo Configuration for Amazon DocumentDB utilizing Spring-Boot and spring-data-mongodb
import com.mongodb.MongoClient;
import com.mongodb.MongoClientOptions;
import com.mongodb.MongoCredential;
import com.mongodb.ServerAddress;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.data.mongodb.config.AbstractMongoConfiguration;
@EliasRanz
EliasRanz / SystemEnvironmentUtil.java
Last active July 13, 2019 16:08
A helper class that allows you to store Google Credential files in Amazon S3, and loads it into context for Google's SDKs.
import java.lang.reflect.Field;
import java.util.Collections;
import java.util.Map;
public class SystemEnvironmentUtil {
public static void setEnv(Map<String, String> newenv) throws ClassNotFoundException, IllegalAccessException, NoSuchFieldException{
try {
Class<?> processEnvironmentClass = Class.forName("java.lang.ProcessEnvironment");
Field theEnvironmentField = processEnvironmentClass.getDeclaredField("theEnvironment");
theEnvironmentField.setAccessible(true);