Vagrant uses Virtualbox to manage the virtual dependencies. You can directly download virtualbox and install or use homebrew for it.
$ brew cask install virtualbox
Now install Vagrant either from the website or use homebrew for installing it.
#!/bin/sh | |
# This command installs binaries at specified versions | |
# into $GOBIN, $GOPATH/bin or $HOME/bin. | |
# It assumes Go 1.11. | |
if [ $# = 0 ]; then | |
usage: vgoget cmdpackage[@version]... >&2 | |
exit 2 | |
fi | |
d=`mktemp -d` | |
cd "$d" |
A brief example on how to use npx
to run gist based scripts.
Read the article here https://neutrondev.com/npm-vs-npx-whats-the-difference/
@blueprint.record_once | |
def record_params(state): | |
"""Store app.config in blueprint when blueprint is registered on app.""" | |
app = state.app | |
blueprint.config = {key: value for key, value in app.config.iteritems()} |
import json | |
import uuid | |
from IPython.display import display_javascript, display_html, display | |
class RenderJSON(object): | |
def __init__(self, json_data): | |
if isinstance(json_data, dict) or isinstance(json_data, list): | |
self.json_str = json.dumps(json_data) | |
else: | |
self.json_str = json_data |
begin | |
require "bundler/inline" | |
rescue LoadError => e | |
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler" | |
raise e | |
end | |
gemfile(true) do | |
source "https://rubygems.org" | |
gem "rails" |
require 'net/http' | |
require 'yaml' | |
files = YAML.load_file("image_list.yml") | |
i = 1 | |
files.each do |file| | |
# use root url without protocol | |
response = Net::HTTP.start("farm5.static.flickr.com") do |http| | |
http.get("#{file}") | |
end | |
puts "#{response}" |
#!/usr/bin/env ruby | |
# Convert command line | |
# | |
#gm convert -font helvetica -fill white -pointsize 20 -draw "text 500,600 'WALLPAPERZ ARE GOOD'" test.jpg output.jpg | |
# | |
#convert -background transparent -fill white -gravity center -size 1024x200 -font Helvetica -pointsize 20 #caption:"I'm a wallpaper, you know what to do" test.jpg +swap -gravity south -composite output.jpg | |
# | |
# Mogrify command line | |
# |
Using gem aws-sdk for a ror application for uploading images to s3 | |
Uploading images to a fixed bucket with different folders for each object or application. | |
The s3 keeps a limitation on the number of buckets creattion whereas there is no | |
limitation for content inside a bucket. | |
This code will upload image for a user to s3 using aws-sdk gem. The bucket and the image uploaded are made public | |
so that the images uploaded are directly accessible. The input it takes is the image complete path | |
where it is present, folder in which it should be uploaded and user_id for whom it should | |
be uploaded. |