Skip to content

Instantly share code, notes, and snippets.

View WillSams's full-sized avatar
🚀

Will Sams WillSams

🚀
View GitHub Profile
@WillSams
WillSams / CSharp-Mode.xshd
Created September 24, 2012 12:47 — forked from marcusholmgren/CSharp-Mode.xshd
VibrantInk inspired syntax highligthing for C# in SharpDevelop
<?xml version="1.0" encoding="utf-8"?>
<!--This file was autogenerated by the #Develop highlighting editor.-->
<!--VibrantInk inspired syntax highligthing for C# in #Develop.-->
<SyntaxDefinition name="C#" extensions=".cs">
<Environment>
<Custom name="TypeReference" bold="false" italic="false" color="Pink" />
<Custom name="UnknownEntity" bold="false" italic="false" color="Yellow" />
<Default bold="false" italic="false" color="White" bgcolor="Black" />
<Selection bold="false" italic="false" color="White" bgcolor="#6897BB" />
<VRuler bold="false" italic="false" color="Pink" bgcolor="#E3E3E3" />
@WillSams
WillSams / DapperTest.py
Created October 11, 2012 15:03
Quick And dirty example of IronPython using Dapper.NET (w/MySql backend and stored procedures)
#DapperTest.py - Quick And dirty example of IronPython using Dapper.NET (w/MySql backend and stored procedures)
import System
import clr
#clr.AddReferenceByPartialName("System.Core")
clr.AddReferenceByPartialName("System.Data")
from System.Collections import IDictionary
from System.Collections.Generic import IDictionary, IList
from System.Data import IDbConnection, IDbCommand, CommandType
@WillSams
WillSams / main.py
Last active September 28, 2022 02:48
MonoGame w/ IronPython Example
import os, clr
clr.AddReferenceToFile("MonoGame.Framework.dll")
clr.AddReferenceToFile("OpenTK.dll")
from Microsoft.Xna.Framework import *
from Microsoft.Xna.Framework.Graphics import *
class App(Game):
def __init__(self):
self.graphics = GraphicsDeviceManager(self)
@WillSams
WillSams / ConfigProxy.cs
Created October 17, 2012 13:29
Configuration Helper file to use with Iron Python apps. Just compile it from the command-line.
//ConfigProxy.cs
// Taken modified:
// http://tomestephens.com/2011/02/making-ironpython-work-overriding-the-configurationmanager/
// http://tomestephens.com/2011/02/extending-my-ironpython-toolset/
// command line compile: csc /target:library /out:ConfigProxy.dll ConfigProxy.cs
// In IronPython, to load up your config file:
// import clr
// clr.AddReference('System.Core')
// clr.AddReference('System.Xml')
// clr.AddReference('System.Configuration')
@WillSams
WillSams / Notepad2.ini
Last active October 11, 2015 19:48
My Notepad2 settings
[Notepad2]
;Notepad2.ini=%WINDIR%\Notepad2-%USERNAME%.ini
;Notepad2.ini=%APPDATA%\Notepad2.ini
[Settings]
SaveSettings=1
SaveRecentFiles=0
SaveFindReplace=0
CloseFind=0
CloseReplace=0
NoFindWrap=0
@WillSams
WillSams / gist:3933697
Created October 22, 2012 19:56 — forked from defnull/gist:1224387
Deploy a Bottle app on Heroku
mkdir heroku
cd heroku/
virtualenv --no-site-packages env
source env/bin/activate
pip install bottle gevent
pip freeze > requirements.txt
cat >app.py <<EOF
import bottle
import os
import logging
import time
logger = logging.getLogger(__name__)
def useful():
logger.debug('Hello from webapplib!')
time.sleep(0.01)
@WillSams
WillSams / gist:4945386
Last active December 13, 2015 17:09
Custom validators for use with jquery validate
jQuery.validator.addMethod("dateGreaterThan", function (value, element, params) {
if (!/Invalid|NaN/.test(new Date(value))) {
return new Date(value) > new Date($(params).val());
}
return isNaN(value) && isNaN($(params).val())
|| (Number(value) > Number($(params).val()));
}, '<br />Must be greater than {0}.');
jQuery.validator.addMethod('greaterThan', function (value, element, param) {

Ubuntu Server Setup Guide for Django Websites

This guide is a walk-through on how to setup Ubuntu Server for hosting Django websites. The Django stack that will be used in this guide is Ubuntu, Nginx, Gunicorn and Postgres. I needed an example site for this guide you can use Django Base Site which is available on Github. For more useful information on Ubuntu server installs, please see the documentation here: https://help.ubuntu.com/12.10/serverguide/

@WillSams
WillSams / ubuntu-postgres.sh
Last active January 5, 2023 14:16
Getting Postgres up & running
!#/bin/sh
# REMOVAL ##################################
sudo apt-get --purge remove postgresql
sudo apt-get purge postgresql*
sudo apt-get --purge remove postgresql postgresql-doc postgresql-common
sudo rm -rf /var/lib/postgresql/
sudo rm -rf /var/log/postgresql/
sudo rm -rf /etc/postgresql/