Skip to content

Instantly share code, notes, and snippets.

View DavidGarciaCat's full-sized avatar

David Garcia DavidGarciaCat

View GitHub Profile
@DavidGarciaCat
DavidGarciaCat / .sensiolabs.yml
Last active July 31, 2017 12:21
SensioLabs Insight - What We Analyze: "Based on the experience of the SensioLabs Audit team, we established a list of 108 control points to make sure an application is safe, reliable, maintainable, that it follows standards and good practices."
rules:
# CRITICAL - SECURITY
# Projects must not depend on dependencies with known security issues
composer.security_issue_in_composer:
enabled: true
# Database queries should use parameter binding
doctrine.database_query_contains_string_and_variable_concatenation:
enabled: true
# PHP debug statements found
php.debug_statements:
@DavidGarciaCat
DavidGarciaCat / check-updates.sh
Created January 28, 2016 10:08
GNU/Linux Shell Script that checks if there are new updates available for the Operating System
#!/bin/bash
TEMP_FILE=/tmp/available-updates.log
apt-get update
sleep 5
dpkg --get-selections | xargs apt-cache policy {} | grep -1 Installed | sed -r 's/(:|Installed: |Candidate: )//' | uniq -u | tac | sed '/--/I,+1 d' | tac | sed '$d' | sed -n 1~2p > $TEMP_FILE
@DavidGarciaCat
DavidGarciaCat / firewall.sh
Created January 28, 2016 10:14
GNU/Linux Firewall - Default rules
#!/bin/bash
# ****************************************************************
# IPTables path
# ****************************************************************
IPT=/sbin/iptables
# ****************************************************************
# Remove/Erase old rules
#!/bin/bash
#
# Program: SSL Certificate Check <ssl-cert-check>
#
# Source code home: http://prefetch.net/code/ssl-cert-check
#
# Documentation: http://prefetch.net/articles/checkcertificate.html
#
# Author: Matty < matty91 at gmail dot com >
#
#!/bin/bash
PO_TOKEN=""
PO_USER=""
PO_BIN=/usr/local/bin/pushover
ZB_TO=$1
ZB_SUBJECT=$2
ZB_BODY=$3
@DavidGarciaCat
DavidGarciaCat / fio-tests.sh
Created August 8, 2016 14:47
Flexible I/O tester - Disk IO performance inspector
#!/bin/sh
if [ ! -d /mnt/fio_test ]; then mkdir /mnt/fio_test; fi
for RUN in 1 2; do
rm -f /mnt/fio_test/*
fio --directory=/mnt/fio_test \
--name fio_test_file --direct=1 --rw=randread --bs=16k --size=1G \
--numjobs=2 --time_based --runtime=180 --group_reporting --norandommap
sleep 5
@DavidGarciaCat
DavidGarciaCat / composer
Created October 13, 2016 15:04
Install composer
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
@DavidGarciaCat
DavidGarciaCat / .bash_profile
Last active October 15, 2016 00:49 — forked from bmhatfield/.profile
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
@DavidGarciaCat
DavidGarciaCat / urlobject.js
Created March 30, 2017 10:25 — forked from aymanfarhat/urlobject.js
JS utility function that: - Breaks down url to an object with accessible properties: protocol, parameters object, host, hash, etc... - Converts url parameters to key/value pairs - Convert parameter numeric values to their base types instead of strings - Store multiple values of a parameter in an array - Unescape parameter values
function urlObject(options) {
"use strict";
/*global window, document*/
var url_search_arr,
option_key,
i,
urlObj,
get_param,
key,