Skip to content

Instantly share code, notes, and snippets.

View carlessanagustin's full-sized avatar

carles san agustin carlessanagustin

View GitHub Profile
@carlessanagustin
carlessanagustin / find-file-in-files.md
Created February 25, 2016 11:07
Finding all files containing a text string on Linux

Finding all files containing a text string on Linux

Do the following:

grep -rnw '/path/to/somewhere/' -e "pattern"

-r or -R is recursive, -n is line number and -w stands match the whole word. -l (lower-case L) can be added to just give the file name of matching files.

@carlessanagustin
carlessanagustin / statuscake_ips.php
Last active August 20, 2023 21:17
Generate a list of StatusCake IP addresses to allow in firewall
<?php
/**
* Generate a list of Status Cake Ip addresses
* To add allowed IPs to Nginx or Firewall
* from: https://www.statuscake.com/kb/knowledge-base/what-are-your-ips/
*/
$statuscake_locations_json = "https://app.statuscake.com/Workfloor/Locations.php?format=json";
$locations = json_decode(file_get_contents($statuscake_locations_json));
$output = "#STATUS CAKE IPs" . "\n";
@carlessanagustin
carlessanagustin / Debconf.md
Last active August 2, 2023 14:07
For unattended installations in Debian Linux environments
@carlessanagustin
carlessanagustin / purge2.sh
Last active July 30, 2023 18:26
Script to reduce VM size before packaging for Vagrant v.2
#!/bin/sh
# Credits to:
# - http://vstone.eu/reducing-vagrant-box-size/
# - https://github.com/mitchellh/vagrant/issues/343
# - https://gist.github.com/adrienbrault/3775253
## for vagrant related tasks, uncomment vagrant comments
# vagrant: Unmount project
@carlessanagustin
carlessanagustin / conf.py
Last active February 6, 2023 14:33
How to send an email with attached text file via Python script?
# 1 FOR TESTING PURPOSES ONLY!!!
debuglevel = 1
# file format to send
pattern = '.txt'
# files to sent path
path = 'path = ‘/path/where/files/to/send/'
# delete file after sending?
delete_files = False
@carlessanagustin
carlessanagustin / .my-zsh.sh
Last active February 3, 2023 07:46
Personal zshrc: alias and sh functions
########## START
RED=$'\e[0;31m'
R=${RED}
BLUE=$'\e[0;34m'
B=${BLUE}
GREEN=$'\e[0;32m'
G=${GREEN}
CYAN=$'\e[0;36m'
C=${CYAN}
YELLOW=$'\e[0;33m'
@carlessanagustin
carlessanagustin / troubleshooting-memory.md
Created November 17, 2015 11:33
Troubleshooting linux MEMORY usage

Troubleshooting linux MEMORY usage

This entry will hopefully show you how to troubleshoot memory used by Linux and application.

Linux System Memory usage

Display amount of free and used memory in the system (-m = in megas)

$ free -m

total used free shared buffers cached

@carlessanagustin
carlessanagustin / loop_over_lists.md
Last active November 18, 2022 17:30
ANSIBLE: Loop over 2 lists
  • playbook test.yml
---
- hosts: localhost
  gather_facts: no
  connection: local

  vars:
    type: st1
@carlessanagustin
carlessanagustin / AdminProductsController.php
Last active November 3, 2022 19:54
Adding a new column to Prestashop 1.6 admin product list. Changes are indicated with "START: carlessanagustin.com" and "END: carlessanagustin.com". 2 files included in this Gist.
<?php
/*
* 2007-2015 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
@carlessanagustin
carlessanagustin / gitconfig.ini
Last active May 31, 2022 07:52
My personal .gitconfig file
[user]
name = Example Name
email = example@example.com
[http]
sslVerify = false
[push]
default = current
[color]
ui = auto
[color "branch"]