Skip to content

Instantly share code, notes, and snippets.

View berkayunal's full-sized avatar

Berkay UNAL berkayunal

View GitHub Profile
@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
@berkayunal
berkayunal / Kredi Kartı BIN Listesi - CSV
Created January 11, 2012 17:16
Kredi Kartı BIN Listesi
bin,banka_kodu,banka_adi,type,sub_type,virtual,prepaid
413226,10,T.C. ZİRAAT BANKASI A.Ş.,VISA,PLATINUM
444676,10,T.C. ZİRAAT BANKASI A.Ş.,VISA,CLASSIC
444677,10,T.C. ZİRAAT BANKASI A.Ş.,VISA,GOLD
444678,10,T.C. ZİRAAT BANKASI A.Ş.,VISA,PLATINUM
453955,10,T.C. ZİRAAT BANKASI A.Ş.,VISA, CLASSIC
453956,10,T.C. ZİRAAT BANKASI A.Ş.,VISA, GOLD
454671,10,T.C. ZİRAAT BANKASI A.Ş.,VISA, CLASSIC
454672,10,T.C. ZİRAAT BANKASI A.Ş.,VISA, CLASSIC
454673,10,T.C. ZİRAAT BANKASI A.Ş.,VISA, BUSINESS
@berkayunal
berkayunal / redis.service
Created February 10, 2017 01:19 — forked from ordoghl/redis.service
redis systemd unit file
Description=Redis In-Memory Data Store
After=network.target
[Service]
Type=forking
User=redis
Group=redis
Environment=statedir=/run/redis
PermissionsStartOnly=true
PIDFile=/run/redis/redis.pid
@berkayunal
berkayunal / pedantically_commented_playbook.yml
Created October 13, 2017 13:39 — forked from marktheunissen/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
@berkayunal
berkayunal / isimler.sql
Created November 25, 2011 04:50 — forked from ismailbaskin/turkce_isimler.sql
isim sözlüğü
CREATE TABLE `isimler` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`ad` varchar(255) COLLATE utf8_bin NOT NULL,
`cinsiyet` varchar(50) COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ad` (`ad`),
KEY `cinsiyet` (`cinsiyet`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
@berkayunal
berkayunal / Alışveriş Kategori Veritabanı
Created February 14, 2012 09:56
Piyasada bulabileceğiniz en geniş ilan, alışveriş kategori veritabanı. Araba,motorsiklet marka, model, alt modellerinden tutun da hizmet ilanı kategorilerine kadar her şey burada tam 36540 kayıt. csv formatında
This file has been truncated, but you can view the full file.
"id","parentID","isim","haschild"
3518,0,"Emlak",1
3613,3518,"Konut",1
16623,3613,"Satılık",1
16633,16623,"Daire",0
152512,16623,"Residence",0
16635,16623,"Müstakil Ev",0
16636,16623,"Villa",0
152456,16623,"Çiftlik Evi",0
152480,16623,"Köşk & Konak",0
@berkayunal
berkayunal / country.php
Created March 21, 2012 13:19
Türkçe Ülke Kodları (ISO 3166-1) Alpha-2
<?php
$lang['country_AF'] = 'Afganistan';
$lang['country_DE'] = 'Almanya';
$lang['country_AD'] = 'Andorra';
$lang['country_AO'] = 'Angola';
$lang['country_AG'] = 'Antigua ve Barbuda';
$lang['country_AR'] = 'Arjantin';
$lang['country_AL'] = 'Arnavutluk';
$lang['country_AW'] = 'Aruba';
$lang['country_AU'] = 'Avustralya';
#!/bin/bash
# Enter the names of the dbs to be backup
# Example: DBONLY=("database1" "cphulkd")
# If you want to backup all
# Example: DBONLY=()
DBONLY=("database1" "cphulkd")
# Enter minutes for file deletetion older than X
# Example 10 Minutes: DELFILESOLDERTHANMIN="10"
@berkayunal
berkayunal / redis-server
Created March 28, 2017 12:11 — forked from sumodirjo/redis-server
redis-server init script
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@berkayunal
berkayunal / elasticsearch.monit
Created May 17, 2018 18:30 — forked from gacha/elasticsearch.monit
Elasticsearch monit
check process elasticsearch with pidfile /var/run/elasticsearch.pid
start program = "/etc/init.d/elasticsearch start"
stop program = "/etc/init.d/elasticsearch stop"
if 5 restarts within 5 cycles then timeout
if failed host 127.0.0.1 port 9200 type http then restart