Skip to content

Instantly share code, notes, and snippets.

Avatar

Alexey Kleandrov akleandrov

  • Russia,Saint-Petersburg
View GitHub Profile
View Profile.java
public static String GetEmail(String login)
{
Session session = HibernateSessionFactory.getSessionFactory().openSession();
session.beginTransaction();
Query query = session.createNativeQuery("select * from target_persons where login= ?1", TargetPersonsEntity.class);
TargetPersonsEntity target = (TargetPersonsEntity) query.getSingleResult();
return target.getEmail();
}
View revit-addin-locations.txt
Autodesk Revit addins are generally loaded from the following locations.
User Addins:
%appdata%\Autodesk\Revit\Addins\
Machine Addins (for all users of the machine):
C:\ProgramData\Autodesk\Revit\Addins\
Addins packaged for the Autodesk Exchange store:
C:\ProgramData\Autodesk\ApplicationPlugins\
@akleandrov
akleandrov / sql
Created Dec 14, 2016
Postgres util-requests
View sql
Drop all connections
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'TARGET_DB'
AND pid <> pg_backend_pid();
Show all connections
select *
from pg_stat_activity
where datname = 'mydatabasename'
View gist:e34ca7e9bdbb096863721794e89cc65b
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class, new JsonDeserializer<Date>() {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
@Override
public Date deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context)
throws JsonParseException {
try {
return df.parse(json.getAsString());
} catch (ParseException e) {
return null;
View test
{
"show_definitions": false,
"auto_complete": false,
"bold_folder_labels": true,
"color_scheme": "Packages/One Dark Material - Theme/schemes/OneDark.tmTheme",
"fold_buttons": false,
"font_size": 13,
"highlight_line": true,
"indent_guide_options":
[
View settingsService.js
/**
* Created by kleandrovaa on 12.01.2017.
*/
/**
* Created by kleandrovaa on 28.12.2016.
*/
'use strict';
snfApp.factory('settingsService', function($http){
let promise;
return {
View 1-restify-server-cheatsheet.js
// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');
View index.html
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.2.3/d3.min.js"></script>
<svg width="600" height="400"></svg>
<script id="jsbin-javascript">
// Стандартный кусок кода для описания ширины и отступов графика
var svg = d3.select("svg"),
margin = { top: 20, right: 20, bottom: 30, left: 50 },
width = +svg.attr("width") - margin.left - margin.right,
height = +svg.attr("height") - margin.top - margin.bottom,
g = svg.append("g").attr("transform", "translate(" + margin.left + "," + margin.top + ")")
@akleandrov
akleandrov / tokens.md
Created May 7, 2018 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию
View tokens.md

Token-Based Authentication(JWT)

Preconditions:

В данной заметке рассматривается работа JWT с симметичным алгоритмом шифрования (HS256/HS384/HS512)

Основы:

Аутентификация(authentication, от греч. αὐθεντικός [authentikos] – реальный, подлинный; от αὐθέντης [authentes] – автор) - это процесс проверки учётных данных пользователя (логин/пароль). Проверка подлинности пользователя путём сравнения введённого им логина/пароля с логином/паролем, сохранённым в базе данных пользователей.

Авторизация(authorization — разрешение, уполномочивание) - это проверка прав пользователя на доступ к определенным ресурсам.

@akleandrov
akleandrov / nginx.conf
Created Jun 5, 2018 — forked from thoop/nginx.conf
Official prerender.io nginx.conf for nginx
View nginx.conf
# Change YOUR_TOKEN to your prerender token and uncomment that line if you want to cache urls and view crawl stats
# Change example.com (server_name) to your website url
# Change /path/to/your/root to the correct value
server {
listen 80;
server_name example.com;
root /path/to/your/root;
index index.html;