Skip to content

Instantly share code, notes, and snippets.

@mikekwright
mikekwright / Index.cshtml
Created February 13, 2013 19:30
Sample of a Razer View for hello world.
@model dynamic
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
@mikekwright
mikekwright / ControllerAction.cs
Created February 13, 2013 19:26
Simple ASP.NET MVC request that returns a hello world html page using Content response.
public ActionResult Index()
{
return Content("<html><body><h1>Hello World</h1></body></html>", "text/html");
}
@mikekwright
mikekwright / server.py
Created February 13, 2013 05:34
This is a sample of a webserver using the flask micro framework for python.
# Run using the below commands
# pip install Flask
# python server.py
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "<html><body><h1>Hello World</h1></body></html>"
@mikekwright
mikekwright / server.rb
Created February 13, 2013 05:29
This is a basic website demonstrating a simple lightweight web application.
require 'sinatra'
get '/' do
"<html><body><h1>Hello World</h1></body></html>"
end
@mikekwright
mikekwright / sample.sh
Created October 20, 2012 01:29
Bash: check for installed package
PACKAGENAME=gcc
if dpkg-query -W $PACKAGENAME
then
echo "You have $PACKAGENAME installed"
else
echo "You don't have $PACKAGENAME installed"
fi
@mikekwright
mikekwright / Rakefile
Created October 20, 2012 01:28
Config: erlang rakefile
require 'rake'
require 'rake/clean'
# Configuration
START_MODULE = "main"
TEST_MODULE = "test_myerlang"
# No Need to change
PWD = `pwd`.strip
INCLUDE = "include"
@mikekwright
mikekwright / makefile
Created October 20, 2012 01:26
Config: basic makefile
CC=g++
LINKER=$(CC)
CFLAGS=-c -Wall
LDFLAGS=
SOURCES=main.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=posix
all: clean $(SOURCES) $(EXECUTABLE)
@mikekwright
mikekwright / sample.sh
Created October 20, 2012 01:23
Bash: read in password
stty -echo
read -p "Password: " PASSWORD; echo
stty echo
@mikekwright
mikekwright / sample.sh
Created October 20, 2012 01:22
Bash: get script directory
SCIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@mikekwright
mikekwright / sample.sh
Created October 20, 2012 01:19
Bash: iterate command line arguments
for arg in "$@"
do
echo "Arguments: $arg"
done