Skip to content

Instantly share code, notes, and snippets.

View bmatusiak's full-sized avatar
👌
Having Fun

Bradley Matusiak bmatusiak

👌
Having Fun
View GitHub Profile
@bmatusiak
bmatusiak / cloud9-install.sh
Last active December 16, 2015 21:20
for linux mint
#!/bin/sh
npm install -g https://github.com/ajaxorg/cloud9/tarball/master
chmod +x ~/.local/bin/cloud9
@bmatusiak
bmatusiak / phpjs-builder.js
Last active December 17, 2015 08:09
PHPJS builder in nodejs
var fs = require("fs");
var dir = __dirname+"/functions";
var mainDirs = [];
var mainFiles = [];
var files = fs.readdirSync(dir);
for(var i in files){

load and initialize

var EJSfile = require("./ejs-helper.js")(__dirname+"/elements");

the dir/elements contains your EJS files

/dir/elements/header.html >>>> <%- header() %>
.clearfix {
*zoom: 1;
}
.clearfix:before,
.clearfix:after {
display: table;
line-height: 0;
content: "";
}
module.exports = function($done){
var doneCalled = false;
function done(){
if(!doneCalled){
doneCalled = true;
$done();
}
}
if(!process.env.C9_PROJECT){
return done();
@bmatusiak
bmatusiak / autorun-cloud9.js
Last active December 23, 2015 03:19
autorun for node.js using fs.watcher and fs.readdir
var c9User = ["ubuntu",1000];
var c9Location = "/home/ubuntu/cloud9";
var nodeLocation = "/usr/local/bin/node";
var spawn = require("child_process").spawn;
process.env.USER = c9User[0];
process.env.HOME = "/home/"+c9User[0];
@bmatusiak
bmatusiak / server.js
Created September 16, 2013 07:14
basic express socket.io ejs server for nodejs
var express = require('express');
var app = express();
var server = require('http').createServer(app);
var io = require('socket.io').listen(server);
var ejs = require("ejs");
var fs = require("fs");
app.configure(function() {
app.use(express.cookieParser("123321aassddccxxzz"));
app.use(express.bodyParser());
app.use(express.session({
var io = require('socket.io/node_modules/socket.io-client');
var socket = io.connect('http://localhost');
socket.emit('require', "bonescript",function(b){
socket.emit("bonescript.digitalWrite","USR0",0);
var on = false;
setInterval(function(){
if(on){
socket.emit("bonescript.digitalWrite","USR0",0);
on = false;
# wget -qO- https://goo.gl/HBY9jh | sh
wget http://www.webmin.com/download/deb/webmin-current.deb -O webmin.deb
sudo apt-get update
sudo apt-get install perl libnet-ssleay-perl libauthen-pam-perl libio-pty-perl apt-show-versions -y
sudo dpkg -i webmin.deb
sudo apt-get -f install -y
rm -rf webmin.deb
#!/bin/bash
if [ -z $@ ];
then
URL=$(cat ~/.playlsit.pl | grep File1 | sed 's/^File1=*//g')
sudo mpg123 $URL
else
wget -O ~/.playlsit.pl $@
URL=$(cat ~/.playlsit.pl | grep File1 | sed 's/^File1=*//g')
sudo mpg123 $URL