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.util.HashMap; | |
import java.util.Map; | |
import java.util.concurrent.atomic.AtomicReference; | |
public class Test { | |
private AtomicReference<Config> configHolder = new AtomicReference<Config>(); | |
private static final class Config { | |
private final Map<String, Double> factorsMap; | |
Config(Map<String, Double> factorsMap) { |
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.util.concurrent.ConcurrentHashMap; | |
import java.util.concurrent.ConcurrentMap; | |
import javax.inject.Provider; | |
public class Test { | |
//it's safe to read from it concurrently, however we don't want that same bean will be created twice | |
private ConcurrentHashMap<String, ConcurrentMap<String, Object>> scopes | |
= new ConcurrentHashMap<String, ConcurrentMap<String, Object>>(50); |
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 jenkins.* | |
import jenkins.model.* | |
import hudson.* | |
import hudson.model.* | |
def DRY_RUN = false | |
def DIRS_FILTER = ['.hg', 'production','logs','apache', 'projects', 'qlickview'] | |
def JOBS_WS_ROOT = 'path-to-your-workspaces-root-dir' | |
def JOBS_IRRELEVANT_SYMBOLS = "[_,-]|\\s" | |
def allJobs = Jenkins.instance.items.findAll { it instanceof hudson.model.Job }.collect { it.name }; |
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
require "pghero/version" | |
require "active_record" | |
require "pghero/engine" if defined?(Rails) | |
module PgHero | |
# hack for connection | |
class Connection < ActiveRecord::Base | |
establish_connection ENV["PGHERO_DATABASE_URL"] if ENV["PGHERO_DATABASE_URL"] | |
end |
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 register_citext_type(conn, con_record): | |
from psycopg2.extensions import new_type, register_type | |
from contextlib import closing | |
def cast_citext(in_str, cursor): | |
if in_str == None: | |
return None | |
return unicode(in_str, cursor.connection.encoding) | |
citext_oid = None | |
with closing(conn.cursor()) as c: |
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
download twitter core, stream and spark-streaming-twitter from maven central and place them into spark/lib | |
run from bin directory: | |
spark-shell --jars ../lib/twitter4j-core-3.0.3.jar,../lib/twitter4j-stream-3.0.3.jar,../lib/spark-streaming-twitter_2.10-1.2.0.jar | |
-------------------------------------------------------------- | |
import org.apache.spark.streaming.{Seconds, StreamingContext} | |
import org.apache.spark.streaming.twitter._ | |
import java.io.FileWriter | |
val filters = List("postgres", "timeseries") |
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
package com.myproject.cassandraloading; | |
import static com.google.common.collect.Iterables.filter; | |
import static com.google.common.collect.Iterables.transform; | |
import java.io.File; | |
import java.lang.management.ManagementFactory; | |
import java.net.InetAddress; | |
import java.net.UnknownHostException; | |
import java.nio.ByteBuffer; |
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
package org.apache.flink.streaming.connectors.fs.avro; | |
/** | |
* Licensed to the Apache Software Foundation (ASF) under one | |
* or more contributor license agreements. See the NOTICE file | |
* distributed with this work for additional information | |
* regarding copyright ownership. The ASF licenses this file | |
* to you 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 |
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
knife search "recipes:xxx*" -a ipaddress | grep ipaddress | awk '{print $2}' |
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
package com.example; | |
import java.util.concurrent.CompletionStage; | |
import scala.concurrent.Await; | |
import scala.concurrent.duration.Duration; | |
import akka.Done; | |
import akka.NotUsed; | |
import akka.actor.ActorSystem; | |
import akka.japi.Pair; |
OlderNewer