Skip to content

Instantly share code, notes, and snippets.

View etoxin's full-sized avatar

Adam Lusted etoxin

View GitHub Profile
@etoxin
etoxin / console.js
Created October 7, 2014 05:40
Highlight HTML elements via console api
[].forEach.call($$("*"),function(a){
a.style.outline="1px solid #"+(~~(Math.random()*(1<<24))).toString(16)
})
@etoxin
etoxin / app.js
Created October 21, 2014 10:33
ArdunioTempSetter CouchDB
var express = require('express');
var http = require('http');
var fs = require('fs');
var request = require('request');
var cheerio = require('cheerio');
var nodeCouchDB = require("node-couchdb");
var couch = new nodeCouchDB("192.168.0.12", 5984);
var app = express();
@etoxin
etoxin / jsOnce.js
Created November 3, 2014 05:56
Run a function Once
function once(fn, context) {
var result;
return function() {
if(fn) {
result = fn.apply(context || this, arguments);
fn = null;
}
return result;
@etoxin
etoxin / terminal.sh
Created November 20, 2014 12:16
Terminal Tips
# Search your command line history
history | grep 'Whatever'
# Discover what's eating your memory
top -o vsize
# Copy to the clipboard
echo "Boom" | pbcopy
# unzip archive into current directory
@etoxin
etoxin / simple-server.sh
Created December 18, 2014 10:06
Simple Server
python -m SimpleHTTPServer
@etoxin
etoxin / ssh.md
Last active June 10, 2020 14:20
SSH

tunnel a remote port on a server to your local machine

ssh -L 12345:localhost:5984 [email protected]

Tunnel a Website through your server to a pre defined port.

blocked websites.

@etoxin
etoxin / Powershell.ps1
Created March 17, 2015 23:20
Powershell Commands
# Find in file. (Grep)
Select-String stringYouWantToSearch .\fileYouWantToSearch.txt
@etoxin
etoxin / complex-each.scss
Created March 23, 2015 04:01
Complex Each in Sass / scss
// icon colouring.
$icon-color-set: (black $black),
(white $white),
(green $green),
(orange $orange),
(red $red),
(utility-blue $utility-blue),
(ocean-blue $ocean-blue),
(transition-blue2 $transition-blue2),
(transition-blue3 $transition-blue3),
@etoxin
etoxin / cron.md
Last active August 29, 2015 14:17
  • To start editing run the following replacing the "testuser" with your desired runtime user for the node process. If you choose a different user other then yourself, you will have to run this with sudo.

$ crontab -u testuser -e

  • If you have never done this before, it will ask you which editor you wish to edit with. I like vim, but will recommend nano for ease of use.

  • Once in the editor add the following line:

@reboot /usr/local/bin/forever start /your/path/to/your/app.js

  • Save the file. You should get some feedback that the cron had been installed.