Skip to content

Instantly share code, notes, and snippets.

@santiaago
santiaago / Program.cs
Created August 13, 2018 11:05
Simple C# NATS example
using System;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using NATS.Client;
namespace worker
{
class Program
{
"contributes": {
"commands": [
{
"command": "extension.sayHello",
"title": "Hello World"
}
]
},
@santiaago
santiaago / main.go
Created February 10, 2015 19:20
Testing HTTP caching in Go
package main
import (
"bytes"
"flag"
"image"
"image/color"
"image/draw"
"image/jpeg"
"log"
@santiaago
santiaago / cache.go
Last active June 24, 2023 18:24
Learning HTTP caching in Go
package main
import (
"bytes"
"flag"
"image"
"image/color"
"image/draw"
"image/jpeg"
"log"
@santiaago
santiaago / chessboard.go
Created January 11, 2015 16:33
Building a chessboard image in go
package main
import (
"image"
"image/color"
"image/jpeg"
"log"
"os"
)
@santiaago
santiaago / driftme.ps1
Last active August 29, 2015 14:13
drift me
param([String]$server="yourservername",
[String]$sqlServerVersion="sql2014",
[String]$dbToDrift="yourdbtodrift",
[String]$tableToDrift="yourtabletodrift")
$previousLocation = Get-Location
Import-Module "sqlps" -DisableNameChecking
SQLSERVER:
$directory = "\sql\{0}\{1}\databases\{2}" -f $server, $sqlServerVersion, $dbToDrift
@santiaago
santiaago / main.go
Last active March 18, 2023 07:57
Playing with images
package main
import (
"bytes"
"encoding/base64"
"flag"
"html/template"
"image"
"image/color"
"image/draw"
@santiaago
santiaago / barchart.html
Created December 11, 2014 00:09
bar chart
<!DOCTYPE html>
<meta charset="utf-8">
<title>Bar Chart with Negative Values</title>
<style>
.bar.positive {
fill: #B9E397;
}
.bar.negative {
@santiaago
santiaago / pieChartData.csv
Last active August 29, 2015 14:11
piechart
sentiment population
positive 50
negative 20
neutral 30
@santiaago
santiaago / randInInterval.go
Last active August 27, 2017 16:01
Random number in a given interval
// computes a random number in the specified interval centered in zero.
func randInInterval(min int, max int) float64 {
r := rand.New(rand.NewSource(time.Now().UnixNano()))
size := float64(max - min)
return r.Float64()*size + float64(min)
}