Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
#define WIN32_LEAN_AND_MEAN | |
#include <winsock2.h> | |
#include <windows.h> | |
#define SECURITY_WIN32 | |
#include <security.h> | |
#include <schannel.h> | |
#include <shlwapi.h> | |
#include <assert.h> | |
#include <stdio.h> |
# Overrides Rails file activerecord/lib/active_record/schema_dumper.rb to | |
# include all schema information in the db/schema.rb file, for example, in the | |
# create_table statements. This allows for a working development database | |
# to be built from a schema.rb file generated by rake db:schema:dump. | |
# | |
# This is essentially a rebuild of the "schema_plus_multischema" gem (which is | |
# unfortunately only compatible with Rails ~> 4.2). | |
# | |
# Tested with Rails 6.0. |
# implementation from https://github.com/rails/rails/pull/16919 | |
# activerecord/lib/active_record/connection_adapters/postgresql/oid/interval.rb | |
require "active_support/duration" | |
module ActiveRecord | |
module ConnectionAdapters | |
module PostgreSQL |
#!/usr/bin/env python3 | |
from argparse import ArgumentParser | |
from subprocess import Popen, PIPE, STDOUT | |
import shlex | |
import hashlib | |
import time | |
import warnings | |
import os, sys, io | |
import signal |
# Enables PostgreSQL interval datatype support (as ActiveSupport::Duration) in Ruby on Rails 4.1. | |
# Based on https://gist.github.com/clarkdave/6529610 | |
require 'active_support/duration' | |
# add a native DB type of :interval | |
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:interval] = { name: 'interval' } | |
# add the interval type to the simplified_type list. because this method is a case statement | |
# we can't inject anything into it, so we create an alias around it so calls to it will call |
table.shingle<-function(..., as.data.frame=F) { | |
dots<-list(...) | |
if(is.logical(as.data.frame) && as.data.frame) { | |
as.data.frame <- list(collapse=T) | |
} | |
stopifnot(all(sapply(dots, class) %in% c("shingle","factor"))) | |
stopifnot(length(unique(sapply(dots, length)))==1) | |
if(is.list(as.data.frame) && !as.data.frame$collapse) { | |
for(i in which(sapply(dots, class)=="shingle")) { | |
pts<-unique(sort(unlist(levels(dots[[i]])))) |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
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?
after_filter :compress | |
def compress | |
if self.request.env['HTTP_ACCEPT_ENCODING'] and self.request.env['HTTP_ACCEPT_ENCODING'].match(/gzip/) | |
if self.response.headers["Content-Transfer-Encoding"] != 'binary' | |
begin | |
ostream = StringIO.new | |
gz = Zlib::GzipWriter.new(ostream) | |
gz.write(self.response.body) | |
self.response.body = ostream.string | |
self.response.headers['Content-Encoding'] = 'gzip' |