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
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <sstream> | |
using namespace std; | |
int main() | |
{ | |
// our data to be "serialized" | |
int turnNumber = 5; |
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
The MIT License (MIT) | |
Copyright (c) 2019 Tony Rasa | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation | |
files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, | |
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software | |
is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
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 class ThrowCounter { | |
public static void main(String[] args) { | |
if (args.length == 0 || args[0].equalsIgnoreCase("bool")) { | |
runBooleanTest(); | |
} else { | |
runThrowTest(); | |
} | |
} |
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
// ============================================================================ | |
// Copyright 2006-2010 Daniel W. Dyer | |
// | |
// Licensed under the Apache License, Version 2.0 (the "License"); | |
// you may not use this file except in compliance with the License. | |
// You may obtain a copy of the License at | |
// | |
// http://www.apache.org/licenses/LICENSE-2.0 | |
// | |
// Unless required by applicable law or agreed to in writing, software |
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
const winston = require('winston'), | |
_ = require('lodash'), | |
moment = require('moment'), | |
Transport = require('winston-transport'), | |
elasticsearch = require('elasticsearch'); | |
module.exports = class SimpleElasticsearch extends Transport { | |
constructor(opts) { | |
super(opts); | |
this.name = 'simple_elasticsearch'; |
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
const winston = require('winston'); // 3.1.0 | |
const winston_es = require('winston-elasticsearch'); // 0.7.7 | |
const util = require('./lib/util.js'); | |
var logger; | |
var transport; | |
// see https://github.com/vanthome/winston-elasticsearch/issues/17#issuecomment-463717315 | |
winston_es.prototype.close = async function () { | |
console.log("closing winston_es"); |
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
@Slf4j | |
@EnableSwagger2 | |
@SpringBootApplication | |
@EnableScheduling | |
@SuppressWarnings("unused") | |
public class Application extends SpringBootServletInitializer { | |
/** | |
* Create our JDBI singleton. Configure plugins. Set options, pooling, etc. | |
* |
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
@Slf4j | |
public class TWR implements Closeable() { | |
public void kaboom() throws IOException { | |
log.info("kaboom"); | |
throw new IOException("io exception here"); | |
} | |
@Override | |
public void close() { | |
log.warn("CLOSED!!"); |
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
#!/usr/bin/env node | |
const | |
program = require('commander'), | |
aws = require('aws-sdk'); | |
aws.config.update({region: 'us-east-1'}); | |
const sqs = new aws.SQS() | |
program.version(module.exports.version); |
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 class VolatileDoubleCheck { | |
private final Object resourceLock = new Object(); | |
private volatile Resource resource; // the thing we want to make sure we only have 1 of, marked as volatile | |
public Resource getResource() { | |
if (resource == null) { | |
synchronized(resourceLock) { | |
if (resource == null) { | |
resource = new Resource(); | |
} |
NewerOlder