Skip to content

Instantly share code, notes, and snippets.

@berkayunal
berkayunal / ._ Loading variables from .env files in Ansible.md
Created January 16, 2018 20:42
Loading variables from .env files in Ansible

Loading variables from .env files in Ansible

Ansible has various ways of looking up data from outside sources, including plain text password files, CSV files and INI files. But it doesn't seem to have a lookup for .env files, as used in Laravel projects, also available for PHP, Ruby, Node.js, Python and others.

One option is to launch Ansible with the Ruby dotenv command line script... But that requires Ruby, which seems like overkill to me.

So here is a simpler solution that I use. It consists of:

  1. The .env file itself
  2. A small shell script that loads the .env file into environment variables - ansible-playbook.sh
@andyrbell
andyrbell / scanner.sh
Last active April 5, 2024 09:01
Make a pdf look scanned using ImageMagick
# use ImageMagick convert
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf
@rictorres
rictorres / vps-test-dd.md
Last active March 2, 2020 05:04
VPS performance tests

Using dd

RunAbove Sandbox [ra]

  • 1 core / 2 GB RAM / 20 GB SSD

EC2 Micro [ec]

  • 1 core / 1 GB RAM / 8 GB

Digital Ocean [do]

  • 1 core / 512 MB RAM / 20 GB SSD
# Русский перевод для https://github.com/plataformatec/devise/blob/6b0d11ed7a457ef1a338718e2e1819aeb25e943d/config/locales/en.yml (3.4.0)
# Другие переводы на http://github.com/plataformatec/devise/wiki/I18n
ru:
devise:
confirmations:
confirmed: "Ваш адрес электронной почты успешно подтвержден."
send_instructions: "В течение нескольких минут Вы получите письмо с инструкциями по подтверждению Вашего адреса электронной почты."
send_paranoid_instructions: "Если Ваш адрес email есть в нашей базе данных, то в течение нескольких минут Вы получите письмо с инструкциями по подтверждению Вашего адреса электронной почты."
failure:
@jberkus
jberkus / gist:6b1bcaf7724dfc2a54f3
Last active January 7, 2024 21:26
Finding Unused Indexes
WITH table_scans as (
SELECT relid,
tables.idx_scan + tables.seq_scan as all_scans,
( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes,
pg_relation_size(relid) as table_size
FROM pg_stat_user_tables as tables
),
all_writes as (
SELECT sum(writes) as total_writes
FROM table_scans
#!/bin/sh
REF=`git symbolic-ref HEAD | sed -e 's/refs\/heads\///'`
REMOTE=`git config --get branch.$REF.remote`
git fetch $REMOTE
git push -f $REMOTE $REF