Skip to content

Instantly share code, notes, and snippets.

@dantheman213
dantheman213 / Vagrantfile
Last active December 15, 2015 04:06
vagrant setup script for development server
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.box_check_update = false
config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.network "forwarded_port", guest: 21, host: 2121
@dantheman213
dantheman213 / legacy_browser_support.html
Created December 22, 2015 19:13
enable ie legacy features
<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
<![endif]-->
@dantheman213
dantheman213 / jquery.outerhtml.js
Created December 23, 2015 22:44
jquery outerhtml
(function($){
var div;
$.fn.outerHTML = function() {
var elem = this[0],
tmp;
return !elem ? null
: typeof ( tmp = elem.outerHTML ) === 'string' ? tmp
: ( div = div || $('<div/>') ).html( this.eq(0).clone() ).html();
@dantheman213
dantheman213 / self_signed_ssl.sh
Created December 27, 2015 17:19
Create self-signed SSL certificate
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout site.key -out site.crt
@dantheman213
dantheman213 / gist:0dad4d4f0b72750c6e6b
Created December 27, 2015 17:28
ssh keyless login
# on local machine you want to be able to remotely login to server "b"
cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys'
@dantheman213
dantheman213 / rpi_adhoc_networking.sh
Created January 10, 2016 22:10
Raspberry Pi Start ad-hoc mode on Start up
1. sudo apt-get update
2. sudo apt-get install isc-dhcp-server
3. sudo nano /etc/default/isc-dhcp-server
> UPDATE LINE
INTERFACES="wlan0"
4. sudo nano /etc/dhcp/dhcpd.conf
@dantheman213
dantheman213 / mongodb_backup.sh
Created January 16, 2016 18:47
backup mongo databases (can be used with a daily crontab)
#!/bin/bash
#
# Creates backup files (bson) of all MongoDb databases on a given server.
# Default behaviour dumps the mongo database and tars the output into a file
# named after the current date. ex: 2011-12-19.tar.gz
#
### Set server settings
HOST="localhost"
PORT="27017" # default mongoDb port is 27017
Setup Wifi Infrastructure Network on RPi 2
1.
apt-get update
apt-get upgrade
2.
apt-get install hostapd udhcpd
@dantheman213
dantheman213 / execute_nodejs_project.sh
Last active June 17, 2018 14:41
Allows NodeJS projects with long path dependancies to run inside Windows vagrant VMs
#!/bin/bash
#
# Summary:
# Exeucute Node.JS projects with 'long path' npm dependancies
# while using Vagrant on Windows
#
# Description:
# Vagrant with a Windows host and a Linux guest has issues with
# very long paths between shared folders. The goal of this script
# is to solve the problem by copying, syncing, and updating dependancies
@dantheman213
dantheman213 / prune_files.js
Created January 22, 2016 00:50
This script will allow you to prune large collections of files by removing duplicates, fixing filename syntax, and organize better
#!/usr/bin/env node
// required packages
// npm install walk
// libraries
var walk = require('walk');
// globals
var args = process.argv.splice(2);