Skip to content

Instantly share code, notes, and snippets.

View getaclue00's full-sized avatar

Alex getaclue00

View GitHub Profile
@getaclue00
getaclue00 / digitalocean.md
Created January 27, 2017 03:45 — forked from stevenchanin/digitalocean.md
Setup instructions for Digital Ocean VPS using Ubuntu and Rails 3.2 #digitalocean #vps #setup

Deploy Rails app to digitalocean with nginx, unicorn, capistrano & postgres

Create Droplet

Create droplet of your liking (ubuntu 12.04 x32) Use an xx.04 LTS version

Setup DNS

On Digital Ocean, create a DNS entry for your server (xyz.com)

Make sure it has NS records that use digital oceans nameservers

@getaclue00
getaclue00 / pg_dump
Created August 12, 2017 18:28 — forked from 63phc/ pg_dump
pg_dump ssh scp
pg_dump name_db > db3.sql
scp root@ip:/home/fgos/code/db3.sql /home/phc/
#####
Пример 1: Копируем файл «file.txt» из удаленного сервера на локальный компьютер.
$ scp user@remote.host:file.txt /some/local/directory
Пример 2: Копируем файл «file.txt» с локального компьютера на удаленный сервер.
$ scp file.txt user@remote.host:/some/remote/directory
@getaclue00
getaclue00 / install-comodo-ssl-cert-for-nginx.rst
Created August 12, 2017 18:42 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@getaclue00
getaclue00 / letteravatar.js
Created August 23, 2017 14:48 — forked from vctrfrnndz/letteravatar.js
Generate SVG letter avatar
function drawCircle(text, size, color) {
var textSize = Math.ceil(size / 2.5);
var font = 'Proxima Nova, proxima-nova, HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif';
var colors = ["#1abc9c", "#16a085", "#f1c40f", "#f39c12", "#2ecc71", "#27ae60", "#e67e22", "#d35400", "#3498db", "#2980b9", "#e74c3c", "#c0392b", "#9b59b6", "#8e44ad", "#bdc3c7", "#34495e", "#2c3e50", "#95a5a6", "#7f8c8d", "#ec87bf", "#d870ad", "#f69785", "#9ba37e", "#b49255", "#b49255", "#a94136"];
var colorIndex = Math.floor((text.charCodeAt(0) - 65) % colors.length);
var finalColor = color || colors[colorIndex];
var template = [
'<svg height="' + size + '" width="' + size + '" style="background: ' + finalColor + '">',
'<text text-anchor="middle" x="50%" y="50%" dy="0.35em" fill="white" font-size="' + textSize + '" font-family="' + font + '">' + text.toUpperCase() + '</text>',
@getaclue00
getaclue00 / laravel-windows-server-iis.md
Created September 14, 2017 18:00 — forked from leabdalla/laravel-windows-server-iis.md
How to use Laravel in Windows IIS

Laravel 4 in Windows Server IIS

###1. Put this web.config in laravel root diretory

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
		<defaultDocument>
 
@getaclue00
getaclue00 / bench_rails_memory_usage.rb
Created November 21, 2017 19:20 — forked from brianhempel/bench_rails_memory_usage.rb
A script to test the memory usage of your Rails application over time. It will run 30 requests against the specified action and report the final RSS. Choose the URL to hit on line 45 and then run with `ruby bench_rails_memory_usage.rb`.
require "net/http"
def start_server
# Remove the X to enable the parameters for tuning.
# These are the default values as of Ruby 2.2.0.
@child = spawn(<<-EOC.split.join(" "))
XRUBY_GC_HEAP_FREE_SLOTS=4096
XRUBY_GC_HEAP_INIT_SLOTS=10000
XRUBY_GC_HEAP_GROWTH_FACTOR=1.8
XRUBY_GC_HEAP_GROWTH_MAX_SLOTS=0
@getaclue00
getaclue00 / Contract Killer 3.md
Created January 18, 2018 16:46
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

//: # Swift 3: URLSessionDelegate
//: The following example shows how to use `OperationQueue` to queue the network requests. This is useful in many ways (for delaying queued requests when the networking goes down for example)
import Foundation
import PlaygroundSupport
class Requester:NSObject {
let opQueue = OperationQueue()
var response:URLResponse?
@getaclue00
getaclue00 / MongoDB_macOS_Sierra.md
Created March 8, 2018 00:41 — forked from nrollr/MongoDB_macOS_Sierra.md
Install MongoDB on Sierra using Homebrew

Install MongoDB on macOS Sierra

This procedure explains how to install MongoDB using Homebrew on macOS Sierra 10.12.
Official MongoDB install documentation: here

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
class AddActivatableFieldsToModel < ActiveRecord::Migration[5.0]
def change
add_column :users, :archived, default: false
add_column :users, :test, default: false
add_column :users, :dummy, default: false
add_index :users, :archived
end
end