Skip to content

Instantly share code, notes, and snippets.

View alistaircol's full-sized avatar
🛑
Stuck at a breakpoint

Ally alistaircol

🛑
Stuck at a breakpoint
View GitHub Profile
@mortenscheel
mortenscheel / functions.sh
Last active July 24, 2024 20:15
Laravel specific git hooks for post-checkout and post-merge
#!/usr/bin/env bash
NC='\033[0m' # No Color
YELLOW='\033[0;33m'
CYAN='\033[0;36m'
GREEN='\033[0;32m'
RED='\033[0;31m'
MAGENTA='\033[0;35m'
notify_about_actions_required() {
changed_files="$(git diff-tree -r --name-status --no-commit-id $1 $2)"
@Mau5Machine
Mau5Machine / docker-compose.yml
Last active July 4, 2024 16:57
Traefik Configuration and Setup
version: "3.3"
services:
################################################
#### Traefik Proxy Setup #####
###############################################
traefik:
image: traefik:v2.0
restart: always
@bmwant
bmwant / ansbile_tips.yml
Last active July 9, 2021 09:53
ansible quick tips for some modules
# Check existing
- name: Ansible check file exists.
stat:
path: /etc/filename
register: file_status
- debug:
msg: "File exists..."
when: file_status.stat.exists
- debug:
msg: "File not found"
@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
@pthiers
pthiers / PHP-Array.groovy
Last active May 23, 2024 16:13
datagrip php array extractor
/*
* Available context bindings:
* COLUMNS List<DataColumn>
* ROWS Iterable<DataRow>
* OUT { append() }
* FORMATTER { format(row, col); formatValue(Object, col) }
* TRANSPOSED Boolean
* plus ALL_COLUMNS, TABLE, DIALECT
*
* where:
# +-----------+-----------+
# | 1_1 | 2_1 |
# | | |
# +-----+-----+-----+-----+
# | 1_2 | 1_3 | 2_2 | 2_3 |
# | | | | |
# +-----+-----+-----+-----+
# | 3_1 | 4_1 |
# +-----------+ |
# | 3_2 +-----+-----+
@b0n
b0n / Popup.php
Created September 13, 2016 03:02 — forked from acfreitas/Popup.php
Working with popup and Behat/Mink Behat3
<?php
use Behat\MinkExtension\Context\RawMinkContext;
/**
* Add Popup in Context
*/
class Popup extends RawMinkContext
{
/**
anonymous
anonymous / MultiCurlHead.php
Created August 26, 2015 17:03
<?php
function getHead($urls){
$results = array();
// make sure the rolling window isn't greater than the # of urls
$rolling_window = 5;
$rolling_window = (sizeof($urls) < $rolling_window) ? sizeof($urls) : $rolling_window;
$master = curl_multi_init();
// $curl_arr = array();
@acfreitas
acfreitas / Popup.php
Last active January 10, 2018 11:18 — forked from blazarecki/PopupDictionary.php
Working with popup and Behat/Mink
<?php
use Behat\Behat\Context\BehatContext;
/**
* Add Popup in Context
*/
class Popup extends BehatContext
{
/**
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule