Skip to content

Instantly share code, notes, and snippets.

@ilguzin
ilguzin / OAuth2Authenticator.scala
Last active October 26, 2022 20:25
OAuth2 authenticator for support this kind of auth in JavaMail IMAP folder requests
import com.typesafe.scalalogging.slf4j.Logging
import com.sun.mail.imap.IMAPSSLStore
import javax.mail.{Store, Session}
import java.security.{Provider, Security}
import java.util.Properties
import OAuth2SaslClientFactory
/**
@ilguzin
ilguzin / idea.vmoptions
Last active March 21, 2022 14:46
High performance Mac OS X IntelliJ IDEA options: /Applications/IntelliJ IDEA 12 CE.app/bin/idea.vmoptions
-server
-Xms512m
-Xmx2048m
-XX:MaxPermSize=512m
-XX:ReservedCodeCacheSize=256m
-XX:+UseCodeCacheFlushing
-XX:+UseCompressedOops
-XX:+UseConcMarkSweepGC
-XX:+AggressiveOpts
-XX:+CMSClassUnloadingEnabled
@ilguzin
ilguzin / Dockerfile
Created May 29, 2019 07:59
Use GitHub as your private NPM registry within your Dockerfile
FROM ...
ARG GITHUB_TOKEN # GITHUB_TOKEN is only defined for build stage! https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line
RUN apk add git # This might contain more system packages depending on what is about to be installed by NPM
RUN git config --global url."https://${GITHUB_TOKEN}:x-oauth-basic@github.com".insteadOf ssh://git@github.com # Force NPM to use https://${GITHUB_TOKEN}:x-oauth-basic@github.com/<user name>/<repository>.git for modules installed from GitHub
COPY package.json /package.json
@ilguzin
ilguzin / docker_adjust_memory.sh
Created May 24, 2019 10:29 — forked from scotthaleen/docker_adjust_memory.sh
Adjust Docker Machine Memory & CPU
# Adjust Docker Machine Memory+CPU
# http://stackoverflow.com/questions/32834082/how-to-increase-docker-machine-memory-mac
docker-machine stop
VBoxManage modifyvm default --cpus 2
VBoxManage modifyvm default --memory 4096
docker-machine start
@ilguzin
ilguzin / .nvmrc
Created June 14, 2018 06:04
VS Code NodeJS settings.
0.12
@ilguzin
ilguzin / env.py
Created June 1, 2018 13:40 — forked from lethee/env.py
Sublime Text 3: Apply NVM environment
# Save this file
# mac - "~/Library/Application Support/Sublime Text 3/Packages/"
# linux - "~/.config/sublime-text-3/Packages/"
# NOTE!
# ~/.nvm/alias/default must contain full version name.
# $ nvm alias default v4.3.5
import os
@ilguzin
ilguzin / gist:6606011
Last active March 9, 2018 07:46
How to convert Java Key Store file to pem/key for nginx
1. Convert our ".jks" file to ".p12" (PKCS12 key store format):
keytool -importkeystore -srckeystore oldkeystore.jks -destkeystore newkeystore.p12 -deststoretype PKCS12
1.1. List new keystore file contents:
keytool -deststoretype PKCS12 -keystore newkeystore.p12 -list
2. Extract pem (certificate) from ".p12" keysotre file:
@ilguzin
ilguzin / nginx_redirect_2named_location
Created November 6, 2013 07:03
NGINX: Redirect from current location into named location
# Use only codes greater than 418, do not use common status codes 404, 402, 403, etc
location /js {
error_page 418 = @backend; return 418;
}
location /data {
error_page 418 = @backend; return 418;
}
@ilguzin
ilguzin / nginx_storage_spray.conf
Last active June 6, 2016 13:33
spray + nginx: serve static with storage API endpoint
server {
listen 443 ssl;
server_name hostname;
ssl on;
ssl_certificate /etc/nginx/ssl_certs/hostname.bndl.crt;
ssl_certificate_key /etc/nginx/ssl_certs/hostname.key;
ssl_session_timeout 5m;
@ilguzin
ilguzin / angular_underscore.js
Created January 14, 2014 19:34
Include UnderscoreJS into angular application as module
// This will simply create link to underscore libraries via wrapping it into service
angular.module('underscore', [])
.factory('_', function() {
return window._;
});