Skip to content

Instantly share code, notes, and snippets.

View patoi's full-sized avatar
👀
...

István Pató patoi

👀
...
View GitHub Profile
@patoi
patoi / gist:11284658
Created April 25, 2014 10:20
SSH commands
PUSH:
* tar cvf - . | gzip -c -1 | ssh user@host cat ">" remotefile.gz
* ssh target_address cat <localfile ">" remotefile
* ssh target_address cat <localfile - ">" remotefile
* cat localfile | ssh target_address cat ">" remotefile
@Bean
EmbeddedServletContainerCustomizer containerCustomizer(
@Value("${keystore.file}") Resource keystoreFile,
@Value("${keystore.pass}") String keystorePass) throws Exception {
String absoluteKeystoreFile = keystoreFile.getFile().getAbsolutePath();
return (ConfigurableEmbeddedServletContainer container) -> {
if (container instanceof TomcatEmbeddedServletContainerFactory) {
@patoi
patoi / gist:b26f35430e54ee3566f7
Created September 30, 2014 08:09
JBOSS EAP 6.2 logging with Spring Boot and jax-ws

Spring Boot and JBOSS EAP 6.2.0 logging

Problem: There is no logging with Java jax-ws client. Other logs are written fine to server.log

logback.xml

import oracle.ons.ONS;
import oracle.ons.SenderThread;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.ReflectionUtils;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

Pub/sub with MongoDB and Node.js

Setup:

$ mongo
> use pubsub
> db.createCollection('messages', { capped: true, size: 100000 })
> db.messages.insert({})
@patoi
patoi / resource_alloc_docker.md
Created April 28, 2016 09:52 — forked from afolarin/resource_alloc_docker.md
Resource Allocation in Docker

#Container Resource Allocation Options in docker-run You have various options for controlling resources (cpu, memory, disk) in docker. These are principally via the docker-run command options.

##Dynamic CPU Allocation -c, --cpu-shares=0
CPU shares (relative weight, specify some numeric value which is used to allocate relative cpu share)

##Reserved CPU Allocation

echo "Type your email, followed by [ENTER]:"
read email
find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && git config user.email $email" \;
@patoi
patoi / RuleSystem.swift
Last active August 16, 2017 18:38
Playing with GameplayKit rule system 1.
//: Check divisible by 3 and 5 with GameplayKit Rule System
import GameplayKit
let divisibleBy3Rule = GKRule(blockPredicate: { system in
(system.state["value"] as! Int) % 3 == 0
}, action: { system in
system.assertFact("divisibleBy3and5", grade: 0.5)
system.assertFact("divisibleBy3", grade: 1)
})
@patoi
patoi / SwiftComponentsAndEntities.swift
Created October 11, 2015 08:14
Swift Components and Entities
//: Playground - noun: a place where people can play
import GameplayKit
class ShootingComponent: GKComponent {
let power: Int
init(power: Int) {
self.power = power
@patoi
patoi / start_testing_java8_today.asciidoc
Last active February 28, 2018 11:44 — forked from aslakknutsen/start_testing_java8_today.asciidoc
Example of how to use both JDK 7 and JDK 8 in one build.

JDK 8 Released

Most of us won’t be able to use/deploy JDK 8 in production for a looong time. But that shouldn’t stop us from using it, right?

It should be possible to sneak in JDK 8 in the back way, the same way we snuck in Groovy and other libraries we wanted to use.

The Test Suite to the rescue

The Maven compiler plugin run in two separate lifecycles, compile and testCompile. Those can be configured separately.