Skip to content

Instantly share code, notes, and snippets.

@Astyk
Astyk / gist:2abb0a475a383630dcb02a9261f2aa20
Created February 16, 2024 10:52 — forked from joshcarr/gist:648079
SVN bash script to export changed files
#!/bin/bash
# USAGE:
# ./svn-export revision-from revision-to repository target-directory
# ./svn-export 20 25 svn://localhost/myrepository .
if [ ! $1 ] || [ ! $2 ] || [ ! $3 ] || [ ! $4 ]; then
echo "Please enter a revision from, revision to, SVN repository, and target directory"
exit
fi
@Astyk
Astyk / jsos_arrayagg.sql
Last active February 11, 2019 14:10
JSON_ARRAYAGG
DELIMITER //
DROP FUNCTION IF EXISTS JSON_ARRAYAGG//
CREATE AGGREGATE FUNCTION IF NOT EXISTS JSON_ARRAYAGG(next_value TEXT) RETURNS TEXT
BEGIN
DECLARE json TEXT DEFAULT '[""]';
DECLARE CONTINUE HANDLER FOR NOT FOUND RETURN json_remove(json, '$[0]');
LOOP
@Astyk
Astyk / tokens.md
Created May 25, 2018 06:10 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication(JWT)

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication(JWT)

Preconditions:

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

Основы:

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

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

@Astyk
Astyk / bright-v8-local.json
Created January 30, 2017 07:12 — forked from klokan/bright-v8-local.json
bright-v8-local.json
{
"version": 8,
"name": "Bright",
"sources": {
"mapbox": {
"url": "http://osm2vectortiles.tileserver.com/v1.json",
"type": "vector"
}
},
@Astyk
Astyk / Envoy.blade.php
Created October 10, 2016 10:35
Laravel Envoy Task Runner
@servers(['staging' => '[email protected]', 'production' => '[email protected]'])
<?php
$app_name = 'l5eka';
$app_path = '/var/www/vhosts/'.$app_name;
$repo = 'https://github.com/vedovelli/l5eka';
$branch = 'aula4';
$github_token = ''; // GitHub OAuth token
$server_name = '192.168.0.99'; // IP ou domínio válido. Usado no nginx
{{-- Define all our servers --}}
@servers(['staging' => '', 'production' => ''])
@setup
{{-- The timezone your servers run in --}}
$timezone = 'Europe/Amsterdam';
{{-- The base path where your deployments are sitting --}}
$path = '/var/www/site.com/htdocs';
@servers(['staging' => '[email protected]', 'production' => '[email protected]'])
<?php
$app_name = 'l5eka';
$app_path = '/var/www/vhosts/'.$app_name;
$repo = 'https://github.com/vedovelli/l5eka';
$branch = 'aula4';
$keep = 6;
$timezone = 'America/Sao_Paulo';
@Astyk
Astyk / AccountAuthenticator.java
Created August 15, 2016 09:55 — forked from burgalon/AccountAuthenticator.java
Implementing OAuth2 with AccountManager, Retrofit and Dagger
public class AccountAuthenticator extends AbstractAccountAuthenticator {
private final Context context;
@Inject @ClientId String clientId;
@Inject @ClientSecret String clientSecret;
@Inject ApiService apiService;
public AccountAuthenticator(Context context) {
super(context);
/*
* Copyright 2016. Dmitry Malkovich
*
* Licensed 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
*
* Unless required by applicable law or agreed to in writing, software
import requests
from requests.auth import HTTPBasicAuth
import re
from StringIO import StringIO
JIRA_URL = 'https://your-jira-url.tld/'
JIRA_ACCOUNT = ('jira-username', 'jira-password')
# the JIRA project ID (short)
JIRA_PROJECT = 'PRO'
GITLAB_URL = 'http://your-gitlab-url.tld/'