Skip to content

Instantly share code, notes, and snippets.

View paulja's full-sized avatar
💭
Gophering... 💻

Paul Jackson paulja

💭
Gophering... 💻
  • Containerising...
  • Wiltshire, UK
  • X @pj_
View GitHub Profile
@paulja
paulja / sort.c
Created September 30, 2013 07:50
kata-2013-09-30
#include <stdio.h>
#include <stdlib.h>
void print (int *, int);
void swap (int *, int, int);
void sort (int *, int, int);
int compare (int, int);
int search (int *, int, int);
int main(int argc, char const *argv[])
// -----------------------------------------------
// AMQP Acknowledgement Sample
//
// Paul Jackson (https://medium.com/@pj_)
var amqp = require('amqp');
// Make a connection
var connection = amqp.createConnection();
@paulja
paulja / bind.js
Last active November 17, 2016 17:28
Node.js Example of the `bind` method to chaining functions.
// -----------------------------------------------------------------
// Bind example
//
// Paul Jackson (pjackson@gmail.com)
// http://blog.paulj.me/
// -----------------------------------------------------------------
// Dependencies
var util = require('util')
@paulja
paulja / mdev.sh
Last active January 31, 2017 14:46
Bash script to step-up a basic dev environment on a Linux box
#!/usr/bin/env bash
#--------------------------------------------------
# install software
#--------------------------------------------------
sudo apt-get update
sudo apt-get upgrade -y
# system
@paulja
paulja / mdev-lite.sh
Last active January 31, 2017 14:47
Bash script to step-up a basic dev-ops environment on a Linux box
#!/usr/bin/env bash
#--------------------------------------------------
# install software
#--------------------------------------------------
sudo apt-get update
sudo apt-get upgrade -y
# system
package main
import (
"fmt"
"time"
)
func main() {
const (
MAX_WORKERS = 2
// Hello World Web Service
var http = require('http')
http.createServer((req, res) => {
res.writeHead(200, { "Content-Type": "text/plain" })
res.write("Hello World")
res.end()
}).listen(3000)
package main
import (
"fmt"
"net/http"
"log"
)
func main() {
http.HandleFunc("/", func (w http.ResponseWriter, req *http.Request) {
package main
import (
"fmt"
"log"
"net/http"
"strconv"
"time"
)
@paulja
paulja / du-dir.sh
Created February 17, 2017 15:56
Shows the disk space in use per item in the current location
#!/bin/bash
for dir in $( ls | xargs );
do
du -sh $dir 2>/dev/null
done