Skip to content

Instantly share code, notes, and snippets.

View k0emt's full-sized avatar

Bryan Nehl k0emt

View GitHub Profile
@k0emt
k0emt / inline-svg.html
Last active February 21, 2021 17:53
Inline SVG, styled with CSS
<!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;
@k0emt
k0emt / mongod.conf
Created October 26, 2015 03:01
example developer YAML configuration file for mongod
# 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
mongod --smallfiles --oplogSize 16 --nojournal
@k0emt
k0emt / 0_reuse_code.js
Created February 1, 2014 18:09
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@k0emt
k0emt / hello_world.tpl
Created June 24, 2013 02:06
Bottle example. The tpl file belongs in a views subdirectory.
%for thing in things:
<li>{{thing}}</li>
%end
@k0emt
k0emt / EnumStringExample.java
Created May 14, 2013 03:24
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 {
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 / init_replica.js
Created May 14, 2013 01:37
Companion javascript to initialize MongoDB replica set.
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 / create_replica_set.bat
Last active November 20, 2016 18:16
Helper batch file for starting up a replica set named m101. Drop the --logpath option if you want to enjoy the log text flying by in the console. The --oplogSize option is the magic sauce to avoid creation of numerous 512MB+ files up to 5% of disk space.
mkdir \data\rs1 \data\rs2 \data\rs3
start mongod --replSet m101 --logpath "1.log" --dbpath \data\rs1 --port 27017 --smallfiles --oplogSize 64
start mongod --replSet m101 --logpath "2.log" --dbpath \data\rs2 --port 27018 --smallfiles --oplogSize 64
start mongod --replSet m101 --logpath "3.log" --dbpath \data\rs3 --port 27019 --smallfiles --oplogSize 64
@k0emt
k0emt / hello_world_bottle.py
Created April 6, 2013 04:50
Example of hello world in bottle with python
import bottle
@bottle.route('/')
def home_page():
return "Hello World\n"
@bottle.route('/testpage')
def test_page():
return "this is a test page"