Skip to content

Instantly share code, notes, and snippets.

View vrudikov's full-sized avatar

Valentin vrudikov

  • Blackhorse Inc
  • Wastelands
View GitHub Profile
@vrudikov
vrudikov / GmailHelper.java
Created January 9, 2018 15:02 — forked from nutanc/GmailHelper.java
Helper class for Gmail API to send and receive mails
import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.auth.oauth2.TokenResponse;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl;
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.googleapis.auth.oauth2.GoogleTokenResponse;
import com.google.api.client.http.GenericUrl;
import com.google.api.client.http.HttpRequest;
import com.google.api.client.http.HttpRequestFactory;
import com.google.api.client.http.HttpTransport;
@nathanborror
nathanborror / instructions.txt
Last active May 17, 2023 00:55
Example Kubernetes setup with Postgres and two Services for serving an API and a static site using Ingress. Also have a CronJob example for kicks.
*** Cluster Setup for Google Container Engine ***
0/ Install and configure local gcloud and kubectl: https://cloud.google.com/sdk/docs/
> gcloud components install kubectl
1/ Configure Google Cloud account:
> gcloud config set account YOUR_EMAIL_ADDRESS
> gcloud config set project YOUR_PROJECT_ID
> gcloud config set compute/zone us-west1-a
> gcloud config set container/cluster example

Quick Tips for Fast Code on the JVM

I was talking to a coworker recently about general techniques that almost always form the core of any effort to write very fast, down-to-the-metal hot path code on the JVM, and they pointed out that there really isn't a particularly good place to go for this information. It occurred to me that, really, I had more or less picked up all of it by word of mouth and experience, and there just aren't any good reference sources on the topic. So… here's my word of mouth.

This is by no means a comprehensive gist. It's also important to understand that the techniques that I outline in here are not 100% absolute either. Performance on the JVM is an incredibly complicated subject, and while there are rules that almost always hold true, the "almost" remains very salient. Also, for many or even most applications, there will be other techniques that I'm not mentioning which will have a greater impact. JMH, Java Flight Recorder, and a good profiler are your very best friend! Mea

@lattner
lattner / TaskConcurrencyManifesto.md
Last active July 25, 2024 20:23
Swift Concurrency Manifesto
@AndreiMarukovich
AndreiMarukovich / docker-compose.yaml
Last active November 8, 2023 07:11
Docker Compose configuration for running TeamCity, build agents and PostgreSQL in Docker containers
version: '2'
services:
postgres:
image: postgres:latest
volumes:
- /srv/postgresql/data:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=<your-password>
- POSTGRES_USER=teamcity
@jeremiegirault
jeremiegirault / UILayoutPriority+operations.swift
Created June 11, 2017 19:03
Helpers for UILayoutPriority for swift 4
extension UILayoutPriority: ExpressibleByFloatLiteral, ExpressibleByIntegerLiteral {
public init(floatLiteral value: Float) {
self.init(rawValue: value)
}
public init(integerLiteral value: Int) {
self.init(rawValue: Float(value))
}
public static func +(lhs: UILayoutPriority, rhs: UILayoutPriority) -> UILayoutPriority {
@ekswai
ekswai / UserRestControllerTest.java
Last active October 23, 2022 13:39
spring oauth2 rest template with client credentials grant sample
import org.junit.Test;
import org.junit.runner.RunWith;
import org.master.Application;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.security.oauth2.client.DefaultOAuth2ClientContext;
import org.springframework.security.oauth2.client.OAuth2RestTemplate;
import org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails;
@steventroughtonsmith
steventroughtonsmith / dp1_target_image_creator.sh
Last active November 15, 2023 23:49
Mac OS X Server 1.x (Rhapsody)/Mac OS X Developer Preview 1 target partition creator for qemu-ppc
#!/bin/sh
TARGET_IMAGE=1G_BLANK_MACOSX_DP1_DISK_IMAGE.img
#1G
DISKSIZE_IN_BLOCKS=2097152
#2G
#DISKSIZE_IN_BLOCKS=4194304
@serac
serac / Application.java
Last active March 25, 2021 16:32
Configuring RestTemplate for Client TLS in a Spring Boot Application
/*
* See LICENSE for licensing and NOTICE for copyright.
*/
package edu.vt.middleware.app;
import java.io.File;
import java.security.*;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;
@diegolirio
diegolirio / JPA-Relacionamento-com-PK-composta.md
Last active April 21, 2017 17:48
JPA-Relacionamento-com-PK-composta
VeiculoDisponivel.java
@Entity
@Table(name = "TDVADM.T_FCF_VEICULODISP")
@IdClass(VeiculoDisponivelPK.class)
public class VeiculoDisponivel {

	@Id @Column(name="FCF_VEICULODISP_CODIGO")
	private String codigo;