$ rails g model User
belongs_to
has_one
| import java.io.BufferedReader; | |
| import java.io.BufferedWriter; | |
| import java.io.InputStreamReader; | |
| import java.io.OutputStreamWriter; | |
| import java.net.InetAddress; | |
| import java.net.Socket; | |
| import java.util.Random; | |
| import javax.script.Invocable; | |
| import javax.script.ScriptEngine; |
| # Place this in your .bash_profile to change your mac address | |
| # Simply run newmac from your terminal and boom, you'll have a new mac address | |
| # Change mac address | |
| function newmac() { | |
| local OLDMAC=$(ifconfig en0 | grep ether | cut -d ' ' -f 2) | |
| local GENMAC=$(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//') | |
| sudo ifconfig en0 ether $GENMAC |
| # This is the easiest way to generate a csv and have it downloaded by the user. | |
| # Drop this in a method in the controller and call it on click. | |
| require 'csv' | |
| file = CSV.generate do |csv| | |
| csv << ["Name", "Email"] # headers | |
| Contact.all.each do |person| | |
| csv << [person.name, person.email] | |
| end |
| var PROXY = { | |
| "direct":"DIRECT", | |
| "gfw":"PROXY 127.0.0.1:8123" | |
| }; | |
| var DEFAULT = "direct"; | |
| var SECTIONS = [ | |
| { | |
| "name":"direct", |
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?