Skip to content

Instantly share code, notes, and snippets.

View eli-oat's full-sized avatar

Eli Mellen eli-oat

View GitHub Profile
awk '{print $1}' < $1 | while read ip; do
if ping -c1 $ip >/dev/null 2>&1; then
echo $ip IS UP
else
echo $ip IS DOWN
fi
done
{
"options": {
"allowStealFocus": false,
"bookmarkThumbHeight": 150,
"bookmarkThumbWidth": 90,
"dropEnabled": true,
"footerPanelEnabled": true,
"headerPanelEnabled": true,
"leftPanelEnabled": true,
"limitLocales": false,
@eli-oat
eli-oat / README.md
Created April 26, 2018 16:46 — forked from miguelmota/README.md
Multiple accounts with Mutt E-Mail Client (gmail example)

How to set up multiple accounts with Mutt E-mail Client

Thanks to this article by Christoph Berg

Instructions

Directories and files

~/
@eli-oat
eli-oat / docker-wordpress.sh
Created April 26, 2018 13:16 — forked from tatemz/docker-wordpress.sh
A quick way to get a WordPress installation up and running with Docker
#!/bin/bash
mkdir wordpress-site && cd wordpress-site
touch docker-compose.yml
cat > docker-compose.yml <<EOL
version: "2"
services:
my-wpdb:
@eli-oat
eli-oat / tp2md.rb
Created April 26, 2018 02:13 — forked from ttscoff/tp2md.rb
#!/usr/bin/env ruby -rjcode -Ku
# TaskPaper to Markdown converter
# Usage: tp2md.rb filename.taskpaper > output.md
require 'ftools'
infile = ARGV[0]
title = File.basename(infile,'.taskpaper').upcase
output = "# #{title} #\n\n"
prevlevel = 0
begin
@eli-oat
eli-oat / addCommas.js
Created April 24, 2018 14:56
Javascript function for adding commas to a number, and returning the resulst as a string (English format)
function addCommas(nStr)
{
nStr += '';
x = nStr.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
@eli-oat
eli-oat / keybase.md
Created April 13, 2018 19:59
keybase.md

Keybase proof

I hereby claim:

  • I am eli-oat on github.
  • I am eli_oat (https://keybase.io/eli_oat) on keybase.
  • I have a public key ASCYxjJW-cHzFuXAioAo5D-0jPn0ds6vUrUrAGMxLaUWPQo

To claim this, I am signing this object:

@eli-oat
eli-oat / download-headers.php
Created April 12, 2018 17:01
PHP function to trigger file download, useful for echoing content to a file rather than to the DOM
<?php
function download_send_headers($filename) {
// disable caching
$now = gmdate("D, d M Y H:i:s");
header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");
header("Cache-Control: max-age=0, no-cache, must-revalidate, proxy-revalidate");
header("Last-Modified: {$now} GMT");
// force download
@eli-oat
eli-oat / select.md
Created March 27, 2018 15:11
trigger URL change on select element's change
<select onchange="location = this.options[this.selectedIndex].value;">
  <option>Please select</option> <option value="http://www.apple.com/">Apple</option>
  <option value="http://www.bbc.com">BBC</option> 
  <option value="http://www.facebook.com">Facebook</option> 
</select> 
@eli-oat
eli-oat / truncate.php
Last active April 17, 2018 19:40
PHP function to truncate a string to a certain length, and replace overflow with an ellip, makes sure not to truncate mid-word.
<?php
function truncate($text, $length = 75, $append = '&hellip;') {
$length = (int) $length;
$text = trim( strip_tags( $text ) );
if ( strlen( $text ) > $length ) {
$text = substr( $text, 0, $length + 1 );
$words = preg_split( "/[\s]|&nbsp;/", $text, -1, PREG_SPLIT_NO_EMPTY );