Skip to content

Instantly share code, notes, and snippets.

@jpswade
jpswade / devops_best_practices.md
Last active October 30, 2024 15:05
Devops Best Practices Checklist

Find the original here article here: Devops Best Practices

DevOps started out as "Agile Systems Administration". In 2008, at the Agile Conference in Toronto, Andrew Shafer posted an offer to moderate an ad hoc "Birds of a Feather" meeting to discuss the topic of "Agile Infrastructure". Only one person showed up to discuss the topic: Patrick Debois. Their discussions and sharing of ideas with others advanced the concept of "agile systems administration". Debois and Shafer formed an Agile Systems Administrator group on Google, with limited success. Patrick Debois did a presentation called "Infrastructure and Operations" addressing

@Jaballadares
Jaballadares / phoneNumberFinderRegex.txt
Last active February 14, 2018 23:12
Javascript Regex to Find Different Formats of Phone Numbers in String of Text
Option 1: (?=.*?\d{3}( |-|.)?\d{4})((?:\+?(?:1)(?:\1|\s*?))?(?:(?:\d{3}\s*?)|(?:\((?:\d{3})\)\s*?))\1?(?:\d{3})\1?(?:\d{4})(?:\s*?(?:#|(?:ext\.?))(?:\d{1,5}))?)\b
Option 2 (maybe better): \+?\d{1,4}?[-.\s]?\(?\d{1,3}?\)?[-.\s]?\d{1,4}[-.\s]?\d{1,4}[-.\s]?\d{1,9}
Option 3: (?:\+?(?<COUNTRY_CODE>\d{1})?-?\(?(?<AREA_CODE>\d{3})\)?[\s-\.]?)?(?<PART1>\d{3})[\s-\.]?(?<PART2>\d{4})[\s-\.]?
@codeZoner
codeZoner / run-command.php
Last active April 12, 2022 19:48
Execute Shell Script using PHP (Git Pull Example)
<?php
// chdir to the correct directory before calling the script
//Ref: https://stackoverflow.com/questions/11052162/run-bash-command-from-php#answer-11052453
$old_path = getcwd();
chdir('/path/to/file');
//make sure to make the shell file executeable first before running the shell_exec function
$output = shell_exec('./shell-script.sh');
chdir($old_path);
echo $output;
@keithweaver
keithweaver / put-object-on-aws-s3.php
Last active May 18, 2023 19:20
Upload an image/object to an AWS S3 Bucket using PHP
<?php
// Installed the need packages with Composer by running:
// $ composer require aws/aws-sdk-php
$filePath = "https://example.com/test.png";
require 'vendor/autoload.php';
$bucketName = 'YOUR_BUCKET_NAME';
$filePath = './YOUR_FILE_NAME.png';
@marcosnakamine
marcosnakamine / index.php
Created April 10, 2017 18:21
PHP - Google Invisible reCAPTCHA example
<html>
<head>
<title>reCAPTCHA demo: Simple page</title>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<script>
function onSubmit(token) {
document.getElementById("demo-form").submit();
}
</script>
</head>
@mubix
mubix / infosec_newbie.md
Last active November 7, 2024 19:11
How to start in Infosec
@lukehedger
lukehedger / ffmpeg-compress-mp4
Last active November 15, 2024 21:28
Compress mp4 using FFMPEG
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4
@sapher
sapher / pic12f615.c
Created November 13, 2014 12:56
PIC12F615 PWM example on AF pin GP5
#include "xc.h"
#include "config.h"
#define _XTAL_FREQ 8000000
/* Variables */
unsigned int i;
void setDuty(unsigned int duty) {
CCPR1L = duty >> 2;
@xdamman
xdamman / install_ffmpeg_ubuntu.sh
Created July 2, 2014 21:03
Install latest ffmpeg on ubuntu 12.04 or 14.04
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
@alojzije
alojzije / connectHTMLelements_SVG.png
Last active November 10, 2024 04:44
Connect two elements / draw a path between two elements with SVG path (using jQuery)
connectHTMLelements_SVG.png