Skip to content

Instantly share code, notes, and snippets.

View babanin's full-sized avatar

Ivan Babanin babanin

View GitHub Profile
@Configuration
class EntityManagerConfiguration(
localContainerEntityManagerFactoryBean: LocalContainerEntityManagerFactoryBean
) {
init {
if (localContainerEntityManagerFactoryBean.jpaDialect is HibernateJpaDialect) {
(localContainerEntityManagerFactoryBean.jpaDialect as HibernateJpaDialect)
.setPrepareConnection(false)
}
}
@zmts
zmts / fingerprint.md
Last active February 1, 2025 11:44
Get browser fingerprint example (fingerprintjs2)

Get browser fingerprint example (fingerprintjs2)

import * as Fingerprint2 from 'fingerprintjs2'
import * as UAParser from 'ua-parser-js'

function _getFingerprint () {
  return new Promise((resolve, reject) => {
    async function getHash () {
      const options = {
@Yotamho
Yotamho / HeapSort.scala
Last active May 3, 2019 23:14
functional implementation of the HeapSort algorithm
object HeapSort {
// functional implementation of the HeapSort algorithm
def swap(arr: Array[Int], i1: Int, i2: Int): Array[Int] = {
val elem1 = arr(i1)
arr.updated(i1, arr(i2)).updated(i2, elem1)
}
def heapifyMax(arr: Array[Int], root: Int, heapSize: Int): Array[Int] = {
@EliasRanz
EliasRanz / MongoConfig.java
Last active June 12, 2024 19:48
Mongo Configuration for Amazon DocumentDB utilizing Spring-Boot and spring-data-mongodb
import com.mongodb.MongoClient;
import com.mongodb.MongoClientOptions;
import com.mongodb.MongoCredential;
import com.mongodb.ServerAddress;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.data.mongodb.config.AbstractMongoConfiguration;
@frankreno
frankreno / search-job-example.py
Last active August 28, 2023 12:04
Sumo Search Job Python API Example
import json
import logging
import requests
import sys
import time
from base64 import b64encode
logging.basicConfig(filename='sumo-search-job.log', level='INFO', format='%(asctime)s %(levelname)s: %(message)s')
logging.info('*************STARTING REQUEST*************')
@svanoort
svanoort / gcsettings.sh
Last active December 20, 2023 02:27
Blessed GC settings for big servers
# Base settings and GC logging
-server -XX:+AlwaysPreTouch # First should be default, but we make it explicit, second pre-zeroes memory mapped pages on JVM startup -- improves runtime performance
# -Xloggc:gc-%t.log # CUSTOMIZE LOCATION HERE - $path/gc-%t.log -- the %t in the gc log file path is so we get a new file with each JVM restart
-XX:NumberOfGCLogFiles=5 -XX:+UseGCLogFileRotation -XX:GCLogFileSize=20m # Limits the number of files, logs to folder
-XX:+PrintGC -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintHeapAtGC -XX:+PrintGCCause
-XX:+PrintTenuringDistribution -XX:+PrintReferenceGC -XX:+PrintAdaptiveSizePolicy # gather info on object age & reference GC time for further tuning if needed.
# G1 specific settings -- probably should be default for multi-core systems with >2 GB of heap (below that, default is probably fine)
-XX:+UseG1GC
-XX:+UseStringDeduplication

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@melekes
melekes / README.md
Last active August 11, 2016 11:28
How to learn any language in six months | Chris Lonsdale | TEDxLingnanUniversity

https://www.youtube.com/watch?v=d0yGdNEWdn0

Краткое содержание

Принципы:

  1. Фокусируйте внимание на контенте, имеющем для вас какое-то значение
  2. Используйте язык как средство для коммуникации начиная с первого дня
  3. Если вы сначала поймёте то, что вам хотели сказать, то вы начинаете овладевать языком бессознательно (comprehensive input)
  4. Изучение нового языка - это также тренировка тела (правильное произношение зависит от мышц)
@leonardofed
leonardofed / README.md
Last active June 23, 2025 12:23
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


@apangin
apangin / HotSpot JVM intrinsics
Last active February 26, 2025 11:43
HotSpot JVM intrinsics
_hashCode java/lang/Object.hashCode()I
_getClass java/lang/Object.getClass()Ljava/lang/Class;
_clone java/lang/Object.clone()Ljava/lang/Object;
_dabs java/lang/Math.abs(D)D
_dsin java/lang/Math.sin(D)D
_dcos java/lang/Math.cos(D)D
_dtan java/lang/Math.tan(D)D
_datan2 java/lang/Math.atan2(DD)D
_dsqrt java/lang/Math.sqrt(D)D
_dlog java/lang/Math.log(D)D