Skip to content

Instantly share code, notes, and snippets.

View cleydyr's full-sized avatar

Cleydyr Bezerra de Albuquerque cleydyr

View GitHub Profile
@cleydyr
cleydyr / gist:bfd7f875d095dcfd625b39786f88f181
Created June 30, 2017 18:45
UsersAdminImpl.hasUpdateFieldPermission
@Override
public boolean hasUpdateFieldPermission(
PermissionChecker permissionChecker, User updatingUser,
User updatedUser, String field)
throws PortalException, SystemException {
// Condição de guarda. Não sei em que caso de uso updatedUser é null.
if (updatedUser == null) {
return true;
}
@cleydyr
cleydyr / gist:62e111af1acdc099fa556ef2fe7abc37
Created August 7, 2017 01:46
Chuva na Montanha - Lô Borges
Intro: D9 Am7 Am4/7 A7/9 Eb7M Am4 Am6 D9 Am4/7 Am7 Am7/9 Eb7M Am4 Am4/7 Am6 Am7/G D7/9
G7M Eb7M Am7 G7M
Anda, vem me lumiar com sua chama, vai anoitecer
Bb/C Gm/E Eb7M9 C/D
Não importa se o vento quer entrar na nossa porta
G7M
Pra assustar você
@cleydyr
cleydyr / recupereseuformulario.sql
Created May 10, 2018 23:31
Script SQL para redefinir o estado do formulário de registro bibliográfico no Biblivre 5
set search_path="single";
INSERT INTO biblio_form_datafields (datafield, collapsed, repeatable, indicator_1, indicator_2, material_type, created, created_by, modified, modified_by) VALUES ('013', false, true, '', '', 'book,manuscript,pamphlet,thesis,computer_legible,map,movie,score,object_3d,photo,periodic,articles,music,nonmusical_sound', '2013-04-13 13:42:03.23405', NULL, '2013-04-13 13:42:03.23405', NULL) ON CONFLICT DO NOTHING;
INSERT INTO biblio_form_datafields (datafield, collapsed, repeatable, indicator_1, indicator_2, material_type, created, created_by, modified, modified_by) VALUES ('020', false, false, '', '', 'book', '2013-04-13 13:42:03.23405', NULL, '2013-04-13 13:42:03.23405', NULL) ON CONFLICT DO NOTHING;
INSERT INTO biblio_form_datafields (datafield, collapsed, repeatable, indicator_1, indicator_2, material_type, created, created_by, modified, modified_by) VALUES ('022', false, false, '', '', 'book,periodic,articles', '2013-04-13 13:42:03.23405', NULL, '2013-04-13 13:42:03.23405', NULL) ON CON
@cleydyr
cleydyr / index.html
Created May 28, 2019 21:53
Hello React
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Hello React!</title>
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/babel-standalone@6.26.0/babel.js"></script>
@cleydyr
cleydyr / RandomEnumDrawer.java
Created April 25, 2021 22:31
A class with a static method to choose randomly among multiple values of a given enum
import java.util.Random;
public class RandomEnumDrawer {
private static Random _rand = new Random(System.currentTimeMillis());
public static <E extends Enum<E>> E randomValue(Class<E> enumClass) {
E[] values = enumClass.getEnumConstants();
E randomValue = values[_rand.nextInt(values.length)];
COPY (SELECT ROW_TO_JSON(t) FROM (SELECT * FROM access_cards) t) TO '/tmp/access_cards.json';
COPY (SELECT ROW_TO_JSON(t) FROM (SELECT * FROM access_control) t) TO '/tmp/access_control.json';
COPY (SELECT ROW_TO_JSON(t) FROM (SELECT * FROM authorities_brief_formats) t) TO '/tmp/authorities_brief_formats.json';
COPY (SELECT ROW_TO_JSON(t) FROM (SELECT * FROM authorities_form_datafields) t) TO '/tmp/authorities_form_datafields.json';
COPY (SELECT ROW_TO_JSON(t) FROM (SELECT * FROM authorities_form_subfields) t) TO '/tmp/authorities_form_subfields.json';
COPY (SELECT ROW_TO_JSON(t) FROM (SELECT * FROM authorities_idx_autocomplete) t) TO '/tmp/authorities_idx_autocomplete.json';
COPY (SELECT ROW_TO_JSON(t) FROM (SELECT * FROM authorities_idx_fields) t) TO '/tmp/authorities_idx_fields.json';
COPY (SELECT ROW_TO_JSON(t) FROM (SELECT * FROM authorities_idx_sort) t) TO '/tmp/authorities_idx_sort.json';
COPY (SELECT ROW_TO_JSON(t) FROM (SELECT * FROM authorities_indexing_groups) t) TO '/tmp/authorities_indexing_groups
@cleydyr
cleydyr / gist:537e724ba09ced94112eeb0fb2edcaa3
Created October 30, 2019 21:10
Criar pasta padrão para backups do Biblivre
tomcat7_home_folder=`getent passwd "tomcat7" | cut -d: -f6`/Biblivre
sudo mkdir $tomcat7_home_folder
sudo chown tomcat7 $tomcat7_home_folder
@cleydyr
cleydyr / recupereseuformulario.sql
Last active September 15, 2023 15:28
Script SQL para redefinir o estado do formulário de registro bibliográfico no Biblivre 5 (compatível com PSQL < 9.5)
set search_path="single";
INSERT INTO biblio_form_datafields (datafield, collapsed, repeatable, indicator_1, indicator_2, material_type, created, created_by, modified, modified_by) SELECT '013', false, true, '', '', 'book,manuscript,pamphlet,thesis,computer_legible,map,movie,score,object_3d,photo,periodic,articles,music,nonmusical_sound', '2013-04-13 13:42:03.23405', NULL, '2013-04-13 13:42:03.23405', NULL WHERE NOT EXISTS (SELECT * FROM biblio_form_datafields bfd WHERE bfd.datafield = '013');
INSERT INTO biblio_form_datafields (datafield, collapsed, repeatable, indicator_1, indicator_2, material_type, created, created_by, modified, modified_by) SELECT '020', false, false, '', '', 'book', '2013-04-13 13:42:03.23405', NULL, '2013-04-13 13:42:03.23405', NULL WHERE NOT EXISTS (SELECT * FROM biblio_form_datafields bfd WHERE bfd.datafield = '020');
INSERT INTO biblio_form_datafields (datafield, collapsed, repeatable, indicator_1, indicator_2, material_type, created, created_by, modified, modified_by) SELECT '022',
@cleydyr
cleydyr / biblivre_centos7_install.sh
Last active May 4, 2024 00:19
Script para instalação automatizada do Biblivre 5 no CentOS 7
# Install Postgresql 9.6
sudo yum install -y postgresql-server postgresql-contrib java-1.8.0-openjdk java-1.8.0-openjdk-devel tomcat
sudo postgresql-setup initdb
# Permite a autenticação com senha no Postgres
echo "Habilitando a autenticação com senha no PostgreSQL"
sudo sed -i -e 's/ident$/md5/g' /var/lib/pgsql/data/pg_hba.conf
# Habilita e inicia serviço do PosgreSQL
@cleydyr
cleydyr / mint_install.sh
Last active May 25, 2024 23:23
Script para implantar Biblivre 5 no Linux Mint, Ubuntu e similares
#!/usr/bin/env bash
# Adiciona repositório que contém o PostgresSQL 9.1 (obsoleto)
echo "Adicionando repositório que contém o PostgresSQL 9.1 (obsoleto)"
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
# Adiciona repositório que contém o Tomcat 7 (obsoleto)
echo "Adicionando repositório que contém o Tomcat 7 (obsoleto)"
sudo sh -c 'echo "deb http://br.archive.ubuntu.com/ubuntu/ xenial main" > /etc/apt/sources.list.d/tomcat7.list'
sudo sh -c 'echo "deb http://br.archive.ubuntu.com/ubuntu/ xenial universe" >> /etc/apt/sources.list.d/tomcat7.list'