Skip to content

Instantly share code, notes, and snippets.

View re9ulus's full-sized avatar

Vasiliy Zemlyanov re9ulus

View GitHub Profile
@enricofoltran
enricofoltran / main.go
Last active April 1, 2024 00:17
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@mblondel
mblondel / letor_metrics.py
Last active January 14, 2024 16:27
Learning to rank metrics.
# (C) Mathieu Blondel, November 2013
# License: BSD 3 clause
import numpy as np
def ranking_precision_score(y_true, y_score, k=10):
"""Precision at rank k
Parameters
@richard-flosi
richard-flosi / bottle-cors.py
Created September 26, 2012 16:55
Bottle with Cross-origin resource sharing (CORS)
"""
Example of setting up CORS with Bottle.py.
"""
from bottle import Bottle, request, response, run
app = Bottle()
@app.hook('after_request')
def enable_cors():
"""
@fnichol
fnichol / README.md
Created March 12, 2011 20:52
Download a cacert.pem for RailsInstaller

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)