DBNAME=# \du
List of roles
Role name | Attributes | Member of
-------------+------------------------------------------------------------+-----------
user | | {}
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
dbuser | | {}
DBNAME=# REASSIGN OWNED BY dbuser TO postgres;
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Simple, zero-downtime deploys with nginx and docker-compose | |
# Thanks to Stephen O'Brien, Head of Product, Tines | |
# Source: https://www.tines.com/blog/simple-zero-downtime-deploys-with-nginx-and-docker-compose | |
set -e | |
set -x | |
compose_yml="${1:-docker-compose.yml}" |
I've been using Fish shell for years which is great and all, but one thing that has got me frustrated is using it with .env
files.
When attempting to run source .env
in a project, I usually encounter this problem:
.env (line 2): Unsupported use of '='. In fish, please use 'set KEY value'.
from sourcing file .env
source: Error while reading file '.env'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
############################################# | |
# Instala o fusioninventory-agent no Ubuntu # | |
############################################# | |
HOST_GLPI="glpi.ifce.taua" | |
[ "$(whoami)" != "root" ] && echo "Precisa ser root" && exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Uma funçãozinha para remover acentos de strings no PostgreSQL... Útil. | |
-- Créditos: papo sql | |
CREATE OR REPLACE FUNCTION retira_acentuacao(p_texto text) RETURNS text AS $BODY$ | |
SELECT TRANSLATE($1, | |
'áàâãäåÁÀÂÃÄÅéèêẽëÉÈÊẼËíìîïÍÌÎÏóòôõöÓÒÔÕÖúùûüÚÙÛŨÜçÇñÑýÝ', | |
'aaaaaaAAAAAAeeeeeEEEEEiiiiIIIIoooooOOOOOuuuuUUUUUcCnNyY' | |
); | |
$BODY$ LANGUAGE SQL VOLATILE COST 100; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Dependencies: convert=ImageMagick and Tesseract | |
INPUT=$1 | |
convert $1 -scale 200% -negate -morphology erode octagon:2 -negate -threshold 80% out.png | |
tesseract -psm 8 -c tessedit_char_whitelist=0123456789 out.png - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
########################################################### | |
# Instalação Java + Palemoon para acesso ao HOD do Serpro # | |
# no xUbuntu 16.04 # | |
########################################################### | |
set -e # para a execução caso haja erro | |
set -x # debug, mostra os comandos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <time.h> | |
int gerar() | |
{ | |
int r = ((rand() % (35 / 2)) + 1) * 2; | |
while (r % 3) | |
{ | |
r = ((rand() % (35 / 2)) + 1) * 2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
echo "== Installing Palemoon 32 bits on Manjaro Linux 64 bits ==" | |
echo | |
echo "Installing deps (lib32) ..." | |
echo | |
yaourt -S --noconfirm lib32-gtk2 lib32-dbus-glib bin-jre7 | |
echo |
NewerOlder