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 / advanced-sync.go
Created March 20, 2018 08:15
Advanced synchronisation block with throttling and cancellation in Go by using channels
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
// first one wins. set of a bunch of tasks and stop when the
@paulja
paulja / simple-sync.go
Created March 20, 2018 08:14
Simple synchronisation block example in Go by using a WaitGroup
package main
import (
"fmt"
"math/rand"
"sync"
"time"
)
func main() {
@paulja
paulja / cf-mon.sh
Last active August 24, 2017 10:46
Cloud Foundry App Monitor
#!/bin/bash
#----------------------------------------------------------
# cf-mon monitors a CF app memory and CPU updating the
# screen as needed
#----------------------------------------------------------
# debugging
#set -ex
function help() {
@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
package main
import (
"fmt"
"log"
"net/http"
"strconv"
"time"
)
package main
import (
"fmt"
"net/http"
"log"
)
func main() {
http.HandleFunc("/", func (w http.ResponseWriter, req *http.Request) {
// 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"
"time"
)
func main() {
const (
MAX_WORKERS = 2
@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
@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