Skip to content

Instantly share code, notes, and snippets.

View bluvertigo's full-sized avatar

Andrea Gentili bluvertigo

View GitHub Profile
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@parth1020
parth1020 / Google Maps Simple Multiple Marker Example
Created January 8, 2013 07:04
Google Maps Simple Multiple Marker Example
<html>
<head>
<title>Google Maps Multiple Markers</title>
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
</head>
<body>
<div id="map" style="height: 400px; width: 500px;">
</div>
<script type="text/javascript">
@paulund
paulund / add-option-to-dropdown.js
Created June 25, 2013 18:50
Add and Remove Options in Select using jQuery
$("#selectBox").append('<option value="option6">option6</option>');
@caferrari
caferrari / array_filter.php
Last active May 30, 2019 10:17
array_filter
<?php
// PHP >= 5.3
// resposta: https://www.facebook.com/groups/nao.tem.biscoito/permalink/10153102397605160/
$required = 282261;
$itens = array_filter($seuArray, function($item) use ($required) {
return $item[0] == $required;
});
@ingdir
ingdir / gist:0b211b9253c376f9cfa5
Last active December 3, 2023 11:47
BEM Cheatsheet

BEM Cheatsheet

BLOCK

Block encapsulates a standalone entity that is meaningful on its own.

While blocks can be nested and interact with each other, semantically they remain equal; there is no precedence or hierarchy.

Holistic entities without DOM representation (such as controllers or models) can be blocks as well.

@dopiaza
dopiaza / slackpost
Created September 5, 2013 12:33
Post a message to a Slack channel
#!/bin/bash
# Usage: slackpost <token> <channel> <message>
# Enter the name of your slack host here - the thing that appears in your URL:
# https://slackhost.slack.com/
slackhost=PUT_YOUR_HOST_HERE
token=$1
@hrwgc
hrwgc / validate.sh
Created November 13, 2013 19:57
bash wget - check if file exists at url before downloading
#!/bin/bash
# simple function to check http response code before downloading a remote file
# example usage:
# if `validate_url $url >/dev/null`; then dosomething; else echo "does not exist"; fi
function validate_url(){
if [[ `wget -S --spider $1 2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then echo "true"; fi
}
@aclud
aclud / youtubeup.sh
Last active April 25, 2018 04:18
Script to take videos FTP'ed from my D-Link DCS-5010L, compile the 15 second clips into one video, upload it to YouTube and email the URL to me.Requires: mencoder mailx youtube-upload (https://code.google.com/p/youtube-upload/)Run via cron
#!/bin/bash
#setup variables
x="/share/cam" #base dir to search
age="1" #minimum age in minutes of file to include in processing
date=$(date +"%Y%m%d%H%M") #date used throughout script
fileprefix="YT-5010L-" #output file name prefix
ytemail="youremail" #your youtube email account
ytpassword="password" #your youtube password
emailfrom="youremail(Your Name)" #your email address and from name
emailuser="youremail" #your gmail address
@matt448
matt448 / slack_nagios.sh
Last active February 13, 2023 15:38
Script to post Nagios notifications into a Slack channel
#!/bin/bash
# This script is used by Nagios to post alerts into a Slack channel
# using the Incoming WebHooks integration. Create the channel, botname
# and integration first and then add this notification script in your
# Nagios configuration.
#
# All variables that start with NAGIOS_ are provided by Nagios as
# environment variables when an notification is generated.
# A list of the env variables is available here: