Skip to content

Instantly share code, notes, and snippets.

Vasiliy Zemlyanov re9ulus

Block or report user

Report or block re9ulus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@enricofoltran
enricofoltran / main.go
Last active Feb 18, 2020
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
View main.go
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@mblondel
mblondel / letor_metrics.py
Last active Jan 31, 2020
Learning to rank metrics.
View letor_metrics.py
# (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 Sep 26, 2012
Bottle with Cross-origin resource sharing (CORS)
View bottle-cors.py
"""
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 Mar 12, 2011
Download a cacert.pem for RailsInstaller
View README.md

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)

You can’t perform that action at this time.