Skip to content

Instantly share code, notes, and snippets.

Bryan Nehl k0emt

Block or report user

Report or block k0emt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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 /
Created Sep 2, 2011
Overloading constructor and variable arguments example
__author__ = 'k0emt'
class Greeter:
def __init__(self):
self.message = 'Hello world!'
# print self.message
class GreeterOverloaded:
def __init__(self, greeting=None):
if greeting is None:
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:
# Where and how to store data.
dbPath: "/var/lib/mongodb"
enabled: true
k0emt /
Last active Dec 12, 2015
MongoDB, PyMongo example working with returned documents.
from pymongo import MongoClient
import pymongo
import sys
# establish a connection to the database
connection = MongoClient("mongodb://localhost", safe=True)
# get a handle to the school database
db =
scores = db.scores
k0emt /
Last active Dec 13, 2015
Utility code to get the keys from a document in a specified MongoDB database and collection.
import sys
from pymongo import MongoClient
if len(sys.argv) < 3:
print 'usage is: ' + sys.argv[0] + ' databaseName collectionName'
dbName = sys.argv[1]
k0emt /
Created Apr 6, 2013
Example of hello world in bottle with python
import bottle
def home_page():
return "Hello World\n"
def test_page():
return "this is a test page"
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"} ]
k0emt /
Created May 14, 2013
Example of working with enums in Java and in particular how to transform them into strings.
public class EnumStringExample {
public static enum DAYS_OF_THE_WEEK {
public String toString() {
String plainName = name().toString();
String fancy = plainName.charAt(0)
+ plainName.substring(1).toLowerCase();
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:
You can’t perform that action at this time.