Skip to content

Instantly share code, notes, and snippets.

Avatar

Bryan Nehl k0emt

View GitHub Profile
@k0emt
k0emt / init_replica.js
Created May 14, 2013
Companion javascript to initialize MongoDB replica set.
View init_replica.js
config = { _id: "m101", members:[
{ _id : 0, host : "localhost:27017"},
{ _id : 1, host : "localhost:27018"},
{ _id : 2, host : "localhost:27019"} ]
};
rs.initiate(config);
rs.status();
@k0emt
k0emt / EnumStringExample.java
Created May 14, 2013
Example of working with enums in Java and in particular how to transform them into strings.
View EnumStringExample.java
public class EnumStringExample {
public static enum DAYS_OF_THE_WEEK {
MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY;
public String toString() {
String plainName = name().toString();
String fancy = plainName.charAt(0)
+ plainName.substring(1).toLowerCase();
@k0emt
k0emt / hello_world.tpl
Created Jun 24, 2013
Bottle example. The tpl file belongs in a views subdirectory.
View hello_world.tpl
%for thing in things:
<li>{{thing}}</li>
%end
@k0emt
k0emt / 0_reuse_code.js
Created Feb 1, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View startdevmongodb.bat
mongod --smallfiles --oplogSize 16 --nojournal
@k0emt
k0emt / mongod.conf
Created Oct 26, 2015
example developer YAML configuration file for mongod
View mongod.conf
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: "/var/lib/mongodb"
journal:
enabled: true
View index.html
<!DOCTYPE html>
<html>
<head>
<link href='https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300' rel='stylesheet' type='text/css'>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<style>
.label {
font-size: 2em;
View svg_1600x900_monitor_pairings.html
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<style>
.label {
font-size: 10em;
font-family:"sans-serif";
View mongodb_lookup.js
use lookup_experiment
db.items.insert({"name":"ink","price":5.55})
db.items.insert({"name":"pen","price":29.95,
"description": {"color":"purple", "manufacturer":"Lamy", "model": "Safari" }})
db.items.insert({"name":"paper","price":5.00})
db.items.insert({"name":"pencil","price":10.00})
db.orders.insert({_id:1, "customer":"inkguy","items":["ink","pen","paper"]})
db.orders.insert({_id:2, "customer":"pencilgal","items":["pencil","paper"]})
You can’t perform that action at this time.