This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import time | |
import logging | |
from datetime import datetime | |
# Set up logging | |
logging.basicConfig(filename='network_log.txt', level=logging.INFO, | |
format='%(asctime)s - %(message)s', datefmt='%Y-%m-%d %H:%M:%S') | |
# File to store outages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// cache any function call, use the args as a key | |
const memoize = (fn) => { | |
let cache = {}; | |
return (...args) => { | |
if (cache[args]) { | |
return cache[args]; | |
} else { | |
let result = fn.apply(this, args); | |
cache[args] = result; | |
return result; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openssl genrsa -des3 -out server.key 2048 | |
openssl rsa -in server.key -out server.key.insecure | |
mv server.key server.key.secure | |
mv server.key.insecure server.key | |
openssl req -new -key server.key -out server.csr | |
cat chain.crt server.crt > server-chain.crt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hood | |
attr_accessor :houses | |
def initialize(houses) | |
@houses = houses | |
end | |
def house_count | |
@houses.count | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# OO for the win! | |
# Bike class | |
# Classes in Ruby are Capitalized and are defined like so... | |
class Bike | |
# Accessors are handy, this is the equivalant of | |
# | |
# def state | |
# @state |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bicycle example for bdw / intro to programming class week 3, basics of methods. | |
# I'm a method without variables | |
def ride | |
"OK, we're rolling..." | |
end | |
# I'm a method with variables | |
def gear_ratio(gearing) | |
(gearing[:front_chainring_gear].to_f / gearing[:rear_chainring_gear].to_f).round(2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/Users/collin/dev/farmhand_dev/vendor/bundle/gems/therubyracer-0.10.1/lib/v8/context.rb:100: [BUG] Segmentation fault | |
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.3.0] | |
-- Control frame information ----------------------------------------------- | |
c:0037 p:---- s:0146 b:0146 l:000145 d:000145 CFUNC :Enter | |
c:0036 p:0043 s:0143 b:0143 l:000142 d:000142 METHOD /Users/collin/dev/farmhand_dev/vendor/bundle/gems/therubyracer-0.10.1/lib/v8/context.rb:100 | |
c:0035 p:0165 s:0140 b:0140 l:000130 d:000139 BLOCK /Users/collin/dev/farmhand_dev/vendor/bundle/gems/therubyracer-0.10.1/lib/v8/context.rb:21 | |
c:0034 p:0028 s:0135 b:0135 l:000134 d:000134 METHOD /Users/collin/dev/farmhand_dev/vendor/bundle/gems/therubyracer-0.10.1/lib/v8/portal.rb:16 | |
c:0033 p:0057 s:0131 b:0131 l:000130 d:000130 METHOD /Users/collin/dev/farmhand_dev/vendor/bundle/gems/therubyracer-0.10.1/lib/v8/context.rb:10 | |
c:0032 p:---- s:0127 b:0127 l:000126 d:000126 FINISH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fast | |
var http = require('http'); | |
http.Server(function(req, res) { | |
res.writeHead(200); | |
res.end("hello world\n"); | |
}).listen(8000); | |
// Faster | |
var cluster = require('cluster'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
├── Gemfile | |
├── Thorfile | |
├── client | |
│ ├── app | |
│ │ ├── config.js | |
│ │ ├── farmhand.js | |
│ │ ├── main.js | |
│ │ ├── modules | |
│ │ │ └── crop.js | |
│ │ └── templates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is the main application configuration file. It is a Grunt | |
// configuration file, which you can learn more about here: | |
// https://github.com/cowboy/grunt/blob/master/docs/configuring.md | |
// | |
module.exports = function(grunt) { | |
grunt.initConfig({ | |
// The clean task ensures all files are removed from the dist/ directory so | |
// that no files linger from previous builds. |
NewerOlder