Skip to content

Instantly share code, notes, and snippets.

View yyolk's full-sized avatar
๐Ÿฏ
๐™ง๐™š๐™˜๐™ช๐™ง๐™จ๐™ž๐™ซ๐™š ๐™ฉ๐™–๐™ช๐™ฉ๐™ค๐™ก๐™ค๐™œ๐™ฎ

Joseph Chiocchi yyolk

๐Ÿฏ
๐™ง๐™š๐™˜๐™ช๐™ง๐™จ๐™ž๐™ซ๐™š ๐™ฉ๐™–๐™ช๐™ฉ๐™ค๐™ก๐™ค๐™œ๐™ฎ
View GitHub Profile
@yyolk
yyolk / isUrlValid.js
Created November 24, 2015 18:03
ripped from paperboy.fm source unknown
function isUrlValid(url) {
return /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF9
@yyolk
yyolk / sns-pushover.php
Created November 8, 2015 00:45 — forked from richardbenson/sns-pushover.php
Simple script to send SNS notifications to your smartphone via Pushover. Requires signing up for Pushover and getting an API key. Then host anywhere and add the URL as subscription to your topic.
<?php
define('PUSHOVER_API_KEY', '<API KEY>'); //Replace with your API Key
$userKey = (isset($_GET['u']) ? $_GET['u'] : '<DEFAULT USER ID>'); //Default user or group
$response = json_decode(file_get_contents('php://input'), true);
switch ($response["Type"]) {
case "SubscriptionConfirmation":
//For this use case, we will just automatically subscribe, we could forward this via email,
@yyolk
yyolk / sample_sns_event.json
Created October 30, 2015 20:52
AWS Lambda SNS Sample Event
{
"Records": [
{
"EventVersion": "1.0",
"EventSubscriptionArn": "arn:aws:sns:EXAMPLE",
"EventSource": "aws:sns",
"Sns": {
"SignatureVersion": "1",
"Timestamp": "1970-01-01T00:00:00.000Z",
"Signature": "EXAMPLE",
@yyolk
yyolk / gist:e818c7ce5696f8f624ad
Created September 29, 2015 20:38 — forked from ericandrewlewis/gist:95239573dc97c0e86714
Setting up a WordPress site on AWS

Setting up a WordPress site on AWS

This tutorial walks through setting up AWS infrastructure for WordPress, starting at creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

This tutorial assumes you're relatively comfortable on the command line and editing system configuration files. It is intended for folks who want a high-level of control and understanding of their infrastructure. It will take about half an hour if you don't Google away at some point.

If you experience any difficulties or have any feedback, leave a comment. ๐Ÿฌ

Coming soon: I'll write another tutorial on a high availability setup for WordPress on AWS, including load-balancing multiple application servers in an auto-scaling group and utilizing RDS.

@yyolk
yyolk / index.js
Last active September 29, 2018 02:28 — forked from vgeshel/function.js
AWS Lambda function for forwarding SNS notifications to Slack
console.log('Loading function');
const https = require('https');
const url = require('url');
// to get the slack hook url, go into slack admin and create a new "Incoming Webhook" integration
const slack_url = 'https://hooks.slack.com/services/...';
const slack_req_opts = url.parse(slack_url);
slack_req_opts.method = 'POST';
slack_req_opts.headers = {'Content-Type': 'application/json'};
/*
Joseph Chiocchi
Word Flash
Description:
Takes some text, and flashes one word at a time to the screen.
*/
var text = $("#ccontent").text();
@yyolk
yyolk / bg.css
Last active August 29, 2015 14:27
Stylish trick
@-webkit-keyframes move {
0%, 100% {
background-position: 1000px 0;
}
50% {
background-position: -1000px 0;
}
}
* {
@yyolk
yyolk / gist:fbfe87aae7190600ff70
Last active August 29, 2015 14:25 — forked from andersonfreitas/gist:4355992
Installing nmon on Amazon Linux AMI

Installing nmon on Amazon Linux AMI

nmon is an excellent performance monitor for Linux systems.

Since Amazon Linux AMI is compatible with RHEL5, I've downloaded a binary RPM from:

http://pkgs.repoforge.org/nmon/

64bit

function Shuffle(o) {
for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
return o;
};
var compiled, exFunc;
exFunc = (function() {
function exFunc() {}
constructor(function(path) {
this.url = path.replace(/[]/g, '/');
this.index = path;
if (path === home) {
this.url = '';