Skip to content

Instantly share code, notes, and snippets.

View jmkelly's full-sized avatar

James Kelly jmkelly

  • Coffs Harbour, Australia
View GitHub Profile
#!/bin/bash
# Replace these values with your actual setup
DISPLAY_NAME="HDMI-1"
WIDTH=2560
HEIGHT=1080
CUSTOM_MODE_NAME="${WIDTH}x${HEIGHT}"
# Use cvt to generate modeline data
MODELINEDATA=$(cvt $WIDTH $HEIGHT | grep Modeline | cut -d' ' -f4-)
#!/bin/bash
#First you update your system
sudo apt-get -y update
#install postgresql-9.6 sources
touch /etc/apt/sources.list.d/pgdg.list
echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" >> /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
sudo apt-key add -
using System;
using System.Threading.Tasks;
using Shouldly;
using Xunit;
namespace ClassLibrary9
{
public class Sample
{
@jmkelly
jmkelly / server_setup.sh
Last active May 10, 2016 10:36
Setup an ubuntu server
#!/bin/bash
#First you update your system
sudo apt-get -y update
#install postgresql-9.5
touch /etc/apt/sources.list.d/pgdg.list
echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" >> /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
sudo apt-key add -
sudo apt-get update
@jmkelly
jmkelly / gist:007a5cd4e95e975d51f8
Created June 23, 2015 23:08
request container resolve nancy
using Nancy;
using Nancy.TinyIoc;
namespace NancyBlankTest
{
public class CustomBootstrapper : DefaultNancyBootstrapper
{
protected override void ConfigureRequestContainer(TinyIoCContainer container, NancyContext context)
{
container.Register<IOwinContext, OwinContext>();
@jmkelly
jmkelly / gist:fbcefb51a7642b21f36a
Created April 29, 2015 10:26
express.js and socket.io push api
var express = require('express');
var hbs = require('express3-handlebars');
var bodyParser = require('body-parser');
var logger = require('morgan');
var moment = require('moment');
var pg = require('pg');
var port = 3333;
var app = express();
@jmkelly
jmkelly / gist:4f793252203e7cc806b6
Created March 29, 2015 06:06
http post from from queue
import pika
import requests
import json
def send_request(data, url):
headers = {'content-type': 'application/json'}
requests.post(url, data=data, headers=headers)
print "successfully: " + data
def on_message(channel, method_frame, header_frame, body):
@jmkelly
jmkelly / gist:4887e3c569e8ef1ded98
Created March 29, 2015 06:03
temperature reading from DHT22 and putting onto RabbitMq queue
import Adafruit_DHT
import pika
import threading
from datetime import datetime
import uuid
import time
import json
sensor = Adafruit_DHT.DHT22
pin = 4
@jmkelly
jmkelly / gist:995cfc8429c8e62a8233
Created February 15, 2015 23:00
js and templating
//small piece of functionality, in this case show a leave form search and it's data
Kernel.module.define('LeaveSearchShow', {
renderTo: "#leave-search-show",
init: function () {
var self = this;
self.hub.listen('leave-search-fetch-complete', function (data) {
self.render(data);
#!/bin/bash
#First you update your system
sudo apt-get -y update && sudo apt-get -y upgrade
#Add Google Chrome packages
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
#Add mono sources
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF