This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'right_aws' | |
aws_access_key_id = 'your-access-key' | |
aws_secret_access_key = 'your-secret-key' | |
target_bucket = 'your-source-bucket' | |
destination_bucket = 'your-destination-bucket' | |
s3 = RightAws::S3Interface.new(aws_access_key_id, aws_secret_access_key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Forum | |
include Mongoid::Document | |
include Mongoid::Timestamps | |
field :posts_count, :type => Integer, :default => 0 | |
has_many_related :posts | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://aws.amazon.com/amazon-linux-ami/ | |
# http://aws.amazon.com/amazon-linux-ami/faqs/ | |
# Boot up a machine with at least 1.5 to 2 GB Ram | |
# login | |
chmod 600 key.pem | |
ssh -i key.pem [email protected] | |
# update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.circle_path(center, radius, complete_path = false) | |
# For increased accuracy, if your data is in a localized area, add the elevation in meters to r_e below: | |
r_e = 6378137.0 | |
@@d2r ||= Math::PI/180 | |
@@multipliers ||= begin | |
segments = 16 | |
dRad = 2*Math::PI/segments | |
(segments + (complete_path ? 1 : 0)).times.map do |i| | |
rads = dRad*i | |
y = Math.sin(rads) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net/url" | |
"strings" | |
) | |
func main() { | |
s := "redis://username:[email protected]:6389/4?pool=25&process=2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import numpy as NP | |
from redis import StrictRedis as redis | |
# a 2D array to serialize | |
A = 10 * NP.random.randn(10000).reshape(1000, 10) | |
# flatten the 2D NumPy array and save it as a binary string | |
array_dtype = str(A.dtype) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Instructions for 4.14 and cuda 9.1 | |
# If upgrading from 4.13 and cuda 9.0 | |
$ sudo apt-get purge --auto-remove libcud* | |
$ sudo apt-get purge --auto-remove cuda* | |
$ sudo apt-get purge --auto-remove nvidia* | |
# also remove the container directory direcotory at /usr/local/cuda-9.0/ | |
# Important libs required with 4.14.x with Cuda 9.X | |
$ sudo apt install libelf1 libelf-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="min-w-full flex flex-row"> | |
<%= turbo_stream_from "demo" %> | |
<div id="demo"></div> | |
</div> |