Skip to content

Instantly share code, notes, and snippets.

View nmajor's full-sized avatar

Nicholas Major nmajor

View GitHub Profile
@nmajor
nmajor / volume_guid.sh
Created November 12, 2015 14:09
Startup script for docker containers to resolve volume permission issues
#!/bin/bash
# Original source of this script: http://stackoverflow.com/questions/23544282/what-is-the-best-way-to-manage-permissions-for-docker-shared-volumes/28596874#28596874
# This will only work for files and folders that allow the group to do what they are trying to do. Wont work on files with 700 permissions for instance.
# Path of mounted volume inside the container
VOLUME_PATH = change/me/path
# Name of user that needs permissions to the volume
USERNAME = changme
@nmajor
nmajor / express-mongoose-rest-boilerplate.js
Created January 6, 2016 20:31
Complete REST Routes and Methods for an Express.js + Mongoose.js API
// controllers/models.js
var Model = require('../models/model');
var modelController = {
find: function(req, res, next) {
Model.where()
.then(function(models) {
res.json(models);
});
},
@nmajor
nmajor / HowToOTGFast.md
Created April 27, 2017 17:28 — forked from gbaman/HowToOTGFast.md
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!

###Setting up Pi Zero OTG - The quick way (No USB keyboard, mouse, HDMI monitor needed)
More details - http://blog.gbaman.info/?p=791

For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in the SD card as well. By default SSH is

class LinkedListNode
attr_accessor :value, :next_node
def initialize(value, next_node=nil)
@value = value
@next_node = next_node
end
end
def cycle_check(list_node)
class LinkedListNode
attr_accessor :value, :next_node
def initialize(value, next_node=nil)
@value = value
@next_node = next_node
end
end
def cycle_check(list_node)
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>title</title>
<link href="https://fonts.googleapis.com/css?family=Droid+Serif:400,700i|Roboto:400,500,700" rel="stylesheet">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="banner">
require_relative 'task'
require_relative 'task_repository'
require_relative 'tasks_controller'
require_relative 'router'
task_repo = TaskRepository.new
task1 = Task.new('Buy bitoque ingredients')
task2 = Task.new('Take train to LeWagon')
task3 = Task.new('Tach an awesome class!')
require 'sqlite3'
DB = SQLite3::Database.new('test.db')
class Doctor
attr_reader :id
def initialize(attributes = {})
@id = attributes[:id]
@name = attributes[:name]
@age = attributes[:age]
class Food
attr_accessor :people_who_like_me
def initialize(attr = {})
@name = attr[:name]
@finger_food = true
@people_who_like_me = []
end
def name
# Puts a welcome message
puts 'WELCOME TO THE SUPERSTORE!'
# Define a sum of 0 euro
sum = 0
# Define a hash (of shopping items)
# with keys as STRINGS and values as floats
items = {