Skip to content

Instantly share code, notes, and snippets.

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

István Pató patoi

👀
...
View GitHub Profile
@joshlong
joshlong / gist:10964238
Created April 17, 2014 08:23
Register this EmbeddedServletContainerCustomizer @bean in a Spring Boot application to customize the embedded Tomcat instance. In particular, this sets up SSL support for the container. I quite like this because it uses Java 8 lambas to nice effect. No finals, no anonymous inner classes. it just... works.
@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: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
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;
@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

@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
@magnetikonline
magnetikonline / README.md
Last active November 10, 2017 14:36
Enable a daily SSD TRIM operation for Ubuntu 12.04+.

SSD TRIM support for Ubuntu 12.04+

Steps to add a daily SSD TRIM task to your Ubuntu system (tested with 12.04+) which will run via anacron with logging of the trim process to /var/log/fstrimall.log.

Note: if you have previously enabled TRIM support for your mounted drive(s) using the discard option within /etc/fstab you will want to remove this option and re-mount your drives first ($ mount -a).

  • Install scripts

    $ sudo wget \

https://gist.github.com/magnetikonline/8190599/raw/fstrimall.sh \

@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.

FROM node:8-alpine
# the client version we will download from bumpx repo
ENV CLIENT_FILENAME instantclient-basic-linux.x64-12.1.0.1.0.zip
# work in this directory
WORKDIR /opt/oracle/lib
# take advantage of this repo to easily download the client (use it at your own risk)
ADD https://github.com/bumpx/oracle-instantclient/raw/master/${CLIENT_FILENAME} .
@franciscopreller
franciscopreller / gist:8427264
Last active April 15, 2019 15:07
AngularJS authentication service which communications with an AspNet Identity Back End running Web API 2.
'use strict';
angular.module('ngApp')
.factory('AuthenticationService', ['$rootScope', '$cookieStore', 'Restangular', '$http', '$q', '$location',
function ($rootScope, $cookieStore, Restangular, $http, $q, $location) {
var UserModel = {
// Set default user state