public static void main(String[] args) {
CouchbaseCluster cluster = CouchbaseCluster.create(
DefaultCouchbaseEnvironment.create(),
"localhost"//nodes
);
CouchbaseTemplate couchbaseTemplate = new CouchbaseTemplate(
cluster.clusterManager(
"user",//username
"auth-example"//password
This file contains hidden or 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 test.app.config; | |
| import com.zaxxer.hikari.HikariDataSource; | |
| import org.springframework.beans.factory.annotation.Qualifier; | |
| import org.springframework.boot.context.properties.ConfigurationProperties; | |
| import org.springframework.boot.jdbc.DataSourceBuilder; | |
| import org.springframework.context.annotation.Bean; | |
| import org.springframework.context.annotation.Configuration; | |
| import org.springframework.context.annotation.DependsOn; | |
| import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; |
- Create ~/.m2/settings.xml
<settings>
<servers>
<server>
<id>internal.repo</id>
<username>${repo.login}</username>
<password>${repo.pwd}</password>
</server>
This file contains hidden or 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
| # Delete branches by regex | |
| git branch | grep "<pattern>" | xargs git branch -D | |
| # Always use current branch as the upstream branch (use: git push -u) | |
| git config --global push.default current |
This file contains hidden or 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 static void main(String[] args) { | |
| File file = new File("/Users/tbibarsov/Downloads/1_000_000_Contacts.xlsx"); | |
| int[] arr = {100, 500, 1_000, 5_000, 10_000, 25_000, 50_000, 100_000, 500_000, 1_000_000, -1}; | |
| for (int i : arr) { | |
| long s = System.currentTimeMillis(); | |
| RowIterator excelRowIterator = getExcelRowIterator( | |
| StreamingReader.builder() | |
| .sstCacheSize(i) | |
| .open(file) | |
| ); |
This file contains hidden or 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 static void main(String[] args) { | |
| ch.qos.logback.classic.Logger rootLogger = (ch.qos.logback.classic.Logger)LoggerFactory.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME); | |
| rootLogger.setLevel(Level.toLevel("trace")); | |
| Logger logger = LoggerFactory.getLogger("Test"); | |
| if(!LOGGER.isDebugEnabled()){ | |
| LOGGER.info("BLA BLA INFO"); | |
| } | |
| LOGGER.debug("BLA BLA DEBUG"); | |
| } |
This file contains hidden or 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 'csv' | |
| file = "#{Rails.root}/public/data.csv" | |
| schools = School.where(state_code: 'CO').order('name ASC') | |
| CSV.open( file, 'w' ) do |writer| | |
| schools.each do |s| | |
| writer << [s.name, s.zipcode, s.id] | |
| end |
This file contains hidden or 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
| CredentialsProvider credsProvider = new BasicCredentialsProvider(); | |
| credsProvider.setCredentials( | |
| new AuthScope("proxy host", 3128), | |
| new UsernamePasswordCredentials("login", "password")); | |
| CloseableHttpClient httpclient = HttpClients.custom() | |
| .setDefaultCredentialsProvider(credsProvider).build(); | |
| try { | |
| HttpHost target = new HttpHost("root target url", 443, "https"); | |
| HttpHost proxy = new HttpHost("proxy host", 3128); |
This file contains hidden or 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
| task fatJar(type: Jar) { | |
| manifest { | |
| attributes 'Implementation-Title': 'Gradle Jar File Example', | |
| 'Implementation-Version': version, | |
| 'Main-Class': 'com.example.Main' | |
| } | |
| baseName = project.name + '-all' | |
| from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } | |
| with jar | |
| } |
NewerOlder