This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void test() { | |
ScheduledExecutorService ex = Executors.newSingleThreadScheduledExecutor(); | |
ex.scheduleAtFixedRate(new Runnable(){ | |
@Override | |
public void run() { | |
scanDirectory(new File(".")); | |
}}, 1, 1, TimeUnit.SECONDS); | |
} | |
private void scanDirectory(File directory) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html ng-app="demo"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>angularjs medium editor | demo</title> | |
<link rel="stylesheet" href="css/normalize.css"> | |
<link rel="stylesheet" href="css/demo.css"> | |
<link rel="stylesheet" href="../../..bower_components/medium-editor/dist/css/medium-editor.css"> | |
<link rel="stylesheet" href="../../..bower_components/medium-editor/dist/css/themes/default.css"> | |
<style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#user nobody; | |
worker_processes 1; | |
#error_log logs/error.log; | |
#error_log logs/error.log notice; | |
#error_log logs/error.log info; | |
#pid logs/nginx.pid; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.io.PrintWriter; | |
import java.net.ServerSocket; | |
import java.net.Socket; | |
public class PlainEchoServer { | |
public void serve(int port) throws IOException { | |
final ServerSocket socket = new ServerSocket(port); // #1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Channel inChannel = ....; | |
ByteBuffer buf = ByteBuffer.allocate(48); | |
int bytesRead = -1; | |
do { | |
bytesRead = inChannel.read(buf); #1 | |
if (bytesRead != -1) { | |
buf.flip(); #2 | |
while(buf.hasRemaining()){ | |
System.out.print((char) buf.get()); #3 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.net.InetSocketAddress; | |
import java.net.ServerSocket; | |
import java.nio.ByteBuffer; | |
import java.nio.channels.SelectionKey; | |
import java.nio.channels.Selector; | |
import java.nio.channels.ServerSocketChannel; | |
import java.nio.channels.SocketChannel; | |
import java.util.Iterator; | |
import java.util.Set; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.net.InetSocketAddress; | |
import java.nio.ByteBuffer; | |
import java.nio.channels.AsynchronousServerSocketChannel; | |
import java.nio.channels.AsynchronousSocketChannel; | |
import java.nio.channels.CompletionHandler; | |
import java.util.concurrent.CountDownLatch; | |
public class PlainNio2EchoServer { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def a = [1,5,7,8,45,7,45,34,45,78,9] | |
k = 10 | |
k0 = 0 | |
void printArr(a) { | |
a.each{i -> | |
print i + ', ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (grunt) { | |
grunt.loadNpmTasks('grunt-karma'); | |
grunt.loadNpmTasks('grunt-contrib-jshint'); | |
grunt.loadNpmTasks('grunt-contrib-concat'); | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
grunt.loadNpmTasks('grunt-jsdoc'); | |
grunt.initConfig({ | |
'pkg': grunt.file.readJSON('package.json'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http. | |
csrf().disable(). | |
sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS). | |
and(). | |
authorizeRequests(). | |
// antMatchers(HttpMethod.OPTIONS, "/**").permitAll(). | |
antMatchers(actuatorEndpoints()).hasRole(backendAdminRole). | |
antMatchers(ApiController.AUTHENTICATE_URL).permitAll(). | |
antMatchers(HttpMethod.GET, ApiController.API_TRIPS).permitAll(). |
OlderNewer