Skip to content

Instantly share code, notes, and snippets.

View OndraZizka's full-sized avatar
🍊

Ondrej Zizka OndraZizka

🍊
View GitHub Profile
@retheviper
retheviper / MimeTypes.kt
Last active June 21, 2023 06:52 — forked from dptsolutions/MimeTypes.kt
Standard MIME type constants ready to use in a Kotlin project
/**
* See [Media Types](https://www.iana.org/assignments/media-types/media-types.xhtml) of IANA.
*/
object MimeTypes {
enum class Application(val extensions: Array<String>, val mimeType: String) {
/** AbiWord document */
ABI_WORD(arrayOf(".abw"), "application/x-abiword"),
/** Archive document (multiple files embedded) */
@roadrunner2
roadrunner2 / 0 Linux-On-MBP-Late-2016.md
Last active February 29, 2024 16:29
Linux on MacBook Pro Late 2016 and Mid 2017 (with Touchbar)

Introduction

This is about documenting getting Linux running on the late 2016 and mid 2017 MPB's; the focus is mostly on the MacBookPro13,3 and MacBookPro14,3 (15inch models), but I try to make it relevant and provide information for MacBookPro13,1, MacBookPro13,2, MacBookPro14,1, and MacBookPro14,2 (13inch models) too. I'm currently using Fedora 27, but most the things should be valid for other recent distros even if the details differ. The kernel version is 4.14.x (after latest update).

The state of linux on the MBP (with particular focus on MacBookPro13,2) is also being tracked on https://github.com/Dunedan/mbp-2016-linux . And for Ubuntu users there are a couple tutorials (here and here) focused on that distro and the MacBook.

Note: For those who have followed these instructions ealier, and in particular for those who have had problems with the custom DSDT, modifying the DSDT is not necessary anymore - se

@dsyer
dsyer / startup.md
Last active October 30, 2023 07:41
Notes on Spring Boot startup performance

Anatomy of Spring Boot Start Up Timing

When a Spring Boot app starts up with default (INFO) logging, there are some noticeable gaps (pauses). It's worth focusing on the gaps when looking for efficiency savings because of the amount of time they take, and because no-one bothered to log anything, so the chances are the app is doing something repetitive. We can tweak the logging levels to try and fill in the gaps and find out what is going on in there.

Basic empty web app with actuators has three such gaps:

0                                                                        1410ms
|------|---------------------------|-----|------|---------|--------|--------|
       |           578             |     |144(5)|         | 133(6) |
@573
573 / readme.md
Last active October 30, 2022 12:48
mvn, how combine.children="append" combine.self="override" (default is "merge" for both) work in multimodule projects
  • the combine.* attributes belong to the configuration elements child elements but in the child not the parent pom
  • let's say we have a prepared configuration for some plugin build::pluginmanagement in the parent pom and the combine rules are applied to some more specific configuration of this plugin inside a profile in the child pom then we need to specify this profile in the mvn call to convince us: mvn -Ptheprofile -f thesubmodule/pom.xml help:effective-pom| less (use the search functionality / and n/SHIFT-n to navigate to the right occurrences)
  • IMHO the combine.children=append rule doesn't really make sense for configuration elements that have children of heterogeneous names, i. e. systemPropertyVariables, here the effect in case some entry already existed in the default configuration another one of the same name would be added i. e. you had <someEntrySays>this</someEntrySays> (from parent pom) and [...]combine...="append"[...]that (from child po
@Faheetah
Faheetah / Jenkinsfile.groovy
Last active March 6, 2024 18:14
Jenkinsfile idiosynchrasies with escaping and quotes
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"
@ajmath
ajmath / ConsoleJsonAppenderFactory.java
Last active August 19, 2022 19:11
Dropwizard Custom Appender
package io.github.ajmath;
import io.dropwizard.logging.AbstractAppenderFactory;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.contrib.jackson.JacksonJsonFormatter;
import ch.qos.logback.contrib.json.classic.JsonLayout;
import ch.qos.logback.core.Appender;
import ch.qos.logback.core.ConsoleAppender;
import ch.qos.logback.core.Layout;
@DecisionNerd
DecisionNerd / csv2json.sh
Created November 13, 2015 03:13
CSV to JSON converter using BASH. Original script from http://blog.secaserver.com/2013/12/convert-csv-json-bash/
#!/bin/bash
# CSV to JSON converter using BASH
# original script from http://blog.secaserver.com/2013/12/convert-csv-json-bash/
# thanks SecaGuy!
# Usage ./csv2json.sh input.csv > output.json
input=$1
[ -z $1 ] && echo "No CSV input file specified" && exit 1
[ ! -e $input ] && echo "Unable to locate $1" && exit 1

progrium/bashstyle

Bash is the JavaScript of systems programming. Although in some cases it's better to use a systems language like C or Go, Bash is an ideal systems language for smaller POSIX-oriented or command line tasks. Here's three quick reasons why:

  • It's everywhere. Like JavaScript for the web, Bash is already there ready for systems programming.
  • It's neutral. Unlike Ruby, Python, JavaScript, or PHP, Bash offends equally across all communities. ;)
  • It's made to be glue. Write complex parts in C or Go (or whatever!), and glue them together with Bash.

This document is how I write Bash and how I'd like collaborators to write Bash with me in my open source projects. It's based on a lot of experience and time collecting best practices. Most of them come from these two articles, but here integrated, slightly modified, and focusing on the most bang for buck items. Plus some ne

@iocanel
iocanel / gist:1979614
Created March 5, 2012 17:25
A wicket jaas session example
public class WicketJaasSession extends AuthenticatedWebSession {
public static final String ROLES_GROUP_NAME = "ROLES";
public static final String ROLES_PREFIX = "ROLE_";
public static final String APPLICATION_POLICY_NAME = "blog";
private Subject subject;
private Roles roles = new Roles();
@SuppressWarnings("deprecation")
public WicketJaasSession(AuthenticatedWebApplication app, Request request) {
@espeed
espeed / trees.groovy
Created September 6, 2011 10:06
Gremlin Trees
// Gremlin user-defined defined tree steps
// inTree() and outTree()
// by James Thornton, http://jamesthornton.com
// see https://groups.google.com/d/topic/gremlin-users/iCPUifiU_wk/discussion
// closure can't have the same name as the defined step
tree = { vertices ->
def results = []