Skip to content

Instantly share code, notes, and snippets.

View aredridel's full-sized avatar
💭
See my social media for status.

Aria Stewart aredridel

💭
See my social media for status.
View GitHub Profile
@aredridel
aredridel / boot-coreos.sh
Last active January 4, 2016 18:12
Set up and boot CoreOS on top of a stock DigitalOcean Fedora 19 install. Abuses the Fedora 19 root as the CoreOS STATE partition. Still todo: copy SSH keys from Fedora install.
#!/bin/sh
kexec --load /boot/coreos_production_pxe.vmlinuz --initrd=/boot/coreos_production_pxe_image.cpio.gz --append='state=/dev/vda root=squashfs: sshkey="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAEAQCZ3fvhC7StXFdFRuXApBuXyS2phoH7ZVKMUMOi3DrbnZWC01GUq74WdalRDHtfq2dl0CPctLb8RHSD+/dKgWEH0gmoEOCio09ZAY5Ui4Cy+0cCGefXkUnJR4lgNOYD076BXjJwsCVCD8sMlFFT08Qn4/voP0jpL1uvvoWiC1KSvSjZf7sP/hRgsO633OuclXyVVq7mC6q+2QVg6hfO49Gt7TVXb+8lc8aUHAYyrXEVag6oICWqxWlSglbEpXCXhK4RB1f8h2vCaEPe2Kf1LNPYJ3dN5H5v+tnst9oZbFjo/qNSm4RvPBb3nsNARdcemdGcwiTjAiIn9gMxBMOyiYOYSgVwGd2U76FR0/RUFUORprynn6uebBhtpGzIAuFsUygMAPAM2tocO+t+h8AQviF6IeA9rKwf5bFTXV9HLy+iUoCWsVBmGypfGbsD7UNg3DIpXv4FdoLDDiCq+OV16ludjLk5pjknshH0cII+Q5b1fcITKSMrZ0CnMytkHHYPTvJ/uc2W9p3howAbMCs+WpNsSnLoCfq5ZjWclauV9Sn7OULQSMuKzTBF+bN7FOyolPbFrW+B3ESUpbonbLbKOubvsBjnUQLNoNjH4pa5Sg3Pluh1EoYLq/oKYU/C+SSwnbRy9N1h2z5UZy/CyrGNG8UomkuFIZWOAGH+zqwU1iCYaWHPgUNXM+4gSe0cGmVesFRpco5nhqvHGdDtw3OCC1U0f9jj6Pk+4jFmulj45+Hu4ZEL8wyMlftbycT8KtuqSVOD/yuytPFlvBzFrjP9s3V8ZN46y5rLpR9dAD+DJHYVESGxQV9lLq2g0p8IJ
@aredridel
aredridel / file1.js
Last active August 29, 2015 13:56 — forked from anonymous/file1.js
var exec = require('child_process').exec;
function wew(cb){
exec("iwlist wlan2 scan|grep -Po '(?<=Address: )\\S+|(?<=Signal level=)\\S+|(?<=ESSID:\")[^\"]+'", test(cb));
}
function test(cb) {
return function (error, stdout, stderr) {
var out = stdout.replace(/^\s+/mg, '');
out = out.split('\n');
var dgram = require('dgram');
var srp = require('srp');
var util = require('util');
var DBConn = require('./dbconn');
var proto = require('./proto');
// UDPApp
//
// This object encompasses all functionality dealing with the UDP endpoint of
var fs = require('fs');
function writeTime(){
var lifedata;
var filename = './life.json';
fs.readFile(filename, 'utf8', function (err, data) {
if (err) throw err;
lifedata = JSON.parse(data);
doWrite();
});
@aredridel
aredridel / private.js
Created January 8, 2014 02:48
A method for having a 'private method' in javascript.
module.exports = function Class() {}
Class.prototype.method = function () {
SomethingInternal.call(this)
}
function SomethingInternal() {
console.log("I'm internal, and I'm currently a method of", this);
}
@aredridel
aredridel / client.html
Last active January 1, 2016 17:29 — forked from raulp/server.js
<script src="http://localhost:3000/socket.io/socket.io.js"></script>
<script>
var news = io.connect('http://localhost:3000/').of('/news');
news.emit("raul", new Array("1","2","3","4","5","6","7","8","9","10") );
news.on('get_random_number_from_raul', function(data) {
console.log('random', data);
});
@aredridel
aredridel / Filesystem.md
Last active December 31, 2015 00:09
Minimal filesystem-like API

Minimal Filesystem-like API

No sync versions of functions. These may encapsulate high-latency remote filesystems. Including sync operations is inappropriate.

fs.rename

fs.stat

Friend.findOne({
userId: req.signedCookies.userid
}, function (err, signedInUser) {
function doCheck(err, currentUser) {
if (err) {
res.send(err);
} else {
console.log('doCheck');
//for(var x = 0; x < users.length; x++) {
//var currentUser = users[x];
module ApplicationHelper
def combine_highlight(selected_text, surrounding_text)
if surrounding_text.include? selected_text
split_text = surrounding_text.split(selected_text)
content_tag(:p, (split_text[0] || '').html_safe + content_tag(:span, selected_text, class:"selected") + (split_text[1] || '').html_safe)
else
content_tag(:p, surrounding_text, class:"selected")
end
end
module ApplicationHelper
def combine_highlight(selected_text, surrounding_text)
if surrounding_text.include? selected_text
split_text_array = surrounding_text.split(selected_text)
if split_text_array[0].blank?
if split_text_array[1].blank?
content_tag(:p, content_tag(:span, selected_text, class:"selected"))
else