Skip to content

Instantly share code, notes, and snippets.

@mateusz-lisik
mateusz-lisik / monitor.py
Created May 10, 2018 13:29
Simple Python socket monitoring script
#!/usr/bin/env python
import sys
import socket
from datetime import datetime
from time import sleep
is_connected = None
package it.lisik.experiments.cleanertest;
import java.lang.ref.Cleaner;
class MyCleaner implements Runnable {
private int currentInstance;
public MyCleaner(int currentInstance) {
this.currentInstance = currentInstance;
}
@mateusz-lisik
mateusz-lisik / AmazonS3Client.java
Last active January 3, 2016 14:00
Modified Aws S3 client with custom support for checking if object exists in bucket
package it.lisik.kodeksy.uploader;
import com.amazonaws.auth.AWSCredentials;
public class AmazonS3Client extends com.amazonaws.services.s3.AmazonS3Client {
public AmazonS3Client() {
super();
}
public AmazonS3Client(AWSCredentials awsCredentials) {
@mateusz-lisik
mateusz-lisik / AuthServerConfig.java
Created December 8, 2015 00:22
OPTIONS friendly AuthorizationServerEndpointsConfiguration
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Primary;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.config.annotation.configuration.ClientDetailsServiceConfiguration;
import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerEndpointsConfiguration;
import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerSecurityConfiguration;
@mateusz-lisik
mateusz-lisik / CorsFilter.java
Created December 7, 2015 23:47
Sample CORS Servlet filter
import org.springframework.stereotype.Component;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@Component
public class CorsFilter implements Filter {
<link rel="import" href="../topeka-elements/category-images.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<polymer-element name="my-element">
<template>
<style>
@mateusz-lisik
mateusz-lisik / robot.js
Created December 4, 2012 07:47 — forked from fabiopimentel/robot.js
Bumblebee
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;