Skip to content

Instantly share code, notes, and snippets.

View rifttech's full-sized avatar
🐳
Focusing

Arthur Abramov rifttech

🐳
Focusing
View GitHub Profile

find differece in commits between 2 branches

git log 
       --pretty=format:"%h - %ch - %<(20) %s" --after="2022-06-22" \
       --right-only --cherry-pick  --no-merges \
        branch...main
@rifttech
rifttech / hibernate-jpa-postgres-issues.md
Created June 10, 2021 06:34 — forked from vegaasen/hibernate-jpa-postgres-issues.md
BLOBs with Postgres and Hibernate caused a lot of headace for me

The problem

It seems like mapping a LOB-type from Hibernate is not as easy as you'd think. If you're like me, you'll toss something like the following annotation to a POJO and hoping that all is fine:

@Lob
@Column(name = "picture")
private byte[] picture;

However, lo and behold - things is not as expected. Hibernate throws all kinds of fancy exceptions - such as:

@rifttech
rifttech / hostname.java
Created January 13, 2020 10:37
Get Hostname
import java.net.InetAddress;
import java.net.UnknownHostException;
// try InetAddress.LocalHost first;
// NOTE -- InetAddress.getLocalHost().getHostName() will not work in certain environments.
try {
String result = InetAddress.getLocalHost().getHostName();
if (StringUtils.isNotEmpty( result))
return result;
} catch (UnknownHostException e) {
@rifttech
rifttech / custom_hooks.py
Created December 6, 2019 16:25
Mercurial - Hooks
import os
import re
def no_cyrillic_hook(ui, repo, **kwargs):
_changedFiles = [os.path.basename(file) for file in repo[kwargs['node']].changeset()[3]]
for t in _changedFiles:
try:
t.decode('ascii')
@rifttech
rifttech / vue.config.js
Created January 10, 2019 08:18
vue cli 3+, cors, devserver, sockjs error
// vue.config.js
module.exports = {
// options...
devServer: {
host: 'localhost',
port: 8080,
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept'
@rifttech
rifttech / resteasy.xml
Created November 18, 2018 11:00
resteasy
<repositories>
<repository>
<id>jboss</id>
<url>http://repository.jboss.org/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<!-- core library -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
@rifttech
rifttech / tomcat-users.xml
Created March 26, 2018 18:13
tomcat mighty user
<?xml version="1.0" encoding="UTF-8"?>
<!--
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
http://www.apache.org/licenses/LICENSE-2.0
@rifttech
rifttech / remove duplicates.sql
Last active March 6, 2018 16:52
remove duplicates postgre
--The following statement uses a suquery to delete duplicate rows and keep the row with the lowest id.
DELETE FROM basket
WHERE id IN
(SELECT id
FROM
(SELECT id,
ROW_NUMBER() OVER( PARTITION BY fruit
ORDER BY id ) AS row_num
FROM basket ) t
WHERE t.row_num > 1 );
@rifttech
rifttech / pom.xml
Created February 17, 2018 07:40
parent pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId></groupId>
<artifactId></artifactId>
<version></version>
<packaging>pom</packaging>
<name></name>
@rifttech
rifttech / wildfly-ubuntu-install.txt
Created February 16, 2018 17:07
Install wildfly on ubuntu
To install WildFly as a service on Ubuntu 14.04 do steps described below.
This guide is suitable for installing WildFly 8 and 9.
In order to run WildFly Java Development Kit (JDK) is required.
To install Oracle JDK you can use WebUpd8 PPA.
To add PPA add-apt-repository utility should be used.