My efforts to port http://www.youtube.com/watch?v=f6kdp27TYZs to Clojure.
func boring(msg string) {
for i := 0; ; i++ {
fmt.Println(msg, i)
time.Sleep(time.Second)
}
/* | |
A Goroutine safe pattern using channels that abstracts away the channels | |
This is a concept of creating a goroutine safe object that uses channels under the covers to communicate | |
with the internal map[string]string structure. I know that typically this kind of solution may done | |
with mutexes but the excercise was in using channels on purpose although they are heavier. | |
Note a couple of points: | |
- When using channels, you can still build a public-facing api that nicely abstracts them away, therefore |
package main | |
import ( | |
"net/http" | |
) | |
type SingleHost struct { | |
handler http.Handler | |
allowedHost string | |
} |
upstream docker_registry { | |
server 127.0.0.1:15000; | |
} | |
server { | |
listen 443; | |
root /dev/null; | |
index index.html index.htm; |
My efforts to port http://www.youtube.com/watch?v=f6kdp27TYZs to Clojure.
func boring(msg string) {
for i := 0; ; i++ {
fmt.Println(msg, i)
time.Sleep(time.Second)
}
###################################################################### | |
# CURRENT AWARE LOCAL DATETIME | |
###################################################################### | |
from datetime import datetime | |
from tzlocal import get_localzone | |
local_tz = get_localzone() | |
local_dt = datetime.now(local_tz) |
#include <iostream> | |
#include <lemon/smart_graph.h> | |
#include <lemon/lgf_reader.h> | |
#include <lemon/lgf_writer.h> | |
#include <lemon/capacity_scaling.h> | |
using namespace lemon; | |
int main() { | |
SmartDigraph g; |
#!/usr/bin/env python | |
# requirements: GitPython | |
# version 0.1 | |
import git | |
import os | |
import sys | |
package main | |
import ( | |
"fmt" | |
"labix.org/v2/mgo" | |
"labix.org/v2/mgo/bson" | |
"time" | |
) | |
type Person struct { |
#!/bin/bash | |
# | |
# PostgreSQL Backup Script Ver 1.0 | |
# http://autopgsqlbackup.frozenpc.net | |
# Copyright (c) 2005 Aaron Axelsen <[email protected]> | |
# | |
# This script is based of the AutoMySQLBackup Script Ver 2.2 | |
# It can be found at http://sourceforge.net/projects/automysqlbackup/ | |
# | |
# The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9 |
package main | |
import ( | |
"compress/gzip" | |
"io" | |
"net/http" | |
"strings" | |
) | |
type gzipResponseWriter struct { |