Skip to content

Instantly share code, notes, and snippets.

@raecoo
raecoo / Backup MySQL to Amazon S3.md
Last active July 3, 2024 01:40 — forked from oodavid/README.md
Backup MySQL to Amazon S3

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc

# use a shared lock and credits_remaining
@lock = Mutex.new
@credits_remaining = 40
@shopify_url = ENV["SHOPIFY_URL"]
# Sends a request to Shopify, blocking until credits are available
def self.request(method, path, params={})
params[:headers] = {"Content-Type" => "application/json"}
# wait for a credit
# use a shared lock and credits_remaining
@lock = Mutex.new
@credits_remaining = 40
@shopify_url = ENV["SHOPIFY_URL"]
# Sends a request to Shopify, blocking until credits are available
def self.request(method, path, params={})
params[:headers] = {"Content-Type" => "application/json"}
# wait for a credit
@raecoo
raecoo / deploy.rb
Created November 15, 2018 13:49 — forked from yanyingwang/deploy.rb
mina+puma+nginx
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
# require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
require 'mina/rvm' # for rvm support. (http://rvm.io)
require 'mina/puma'
require 'mina/nginx'
# Basic settings:
@raecoo
raecoo / curl-get-status-code-and-response-body.sh
Created September 16, 2018 01:06 — forked from maxclaus/curl-get-status-code-and-response-body.sh
Curl - Get status code and response body
URL="http://stackoverflow.com/"
# store the whole response with the status at the and
HTTP_RESPONSE=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -X POST $URL)
# extract the body
HTTP_BODY=$(echo $HTTP_RESPONSE | sed -e 's/HTTPSTATUS\:.*//g')
# extract the status
HTTP_STATUS=$(echo $HTTP_RESPONSE | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')
@raecoo
raecoo / Example.scala
Created September 10, 2018 06:25 — forked from xuwei-k/Example.scala
msgpack4zとmsgpack4z-circeのサンプル
package example
import msgpack4z._
import msgpack4z.CodecInstances.all._
import scalaz.{\/-, -\/}
// テスト用case class
case class TestClass(foo: Int, bar: String)
object TestClass {
@raecoo
raecoo / MockHBaseConnection.java
Created September 5, 2018 06:27 — forked from DonDebonair/MockHBaseConnection.java
MockHBaseTable & MockHBaseConnection
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.*;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;
/**
@raecoo
raecoo / ConsumerExample.scala
Created July 20, 2018 01:46 — forked from fancellu/ConsumerExample.scala
Kafka Producer/Consumer Example in Scala
import java.util
import org.apache.kafka.clients.consumer.KafkaConsumer
import scala.collection.JavaConverters._
object ConsumerExample extends App {
import java.util.Properties
@raecoo
raecoo / gist:9c85d647e2a45bd632751afb455c0e30
Created June 6, 2018 05:57 — forked from siddharthg/gist:6923b2cbb402bd65255af7859a5d52a5
Install Thrift 0.10.0 with brew on macOS
brew unlink thrift
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/16ebe5f1843e6cb54856311ff0f676be53007329/Formula/thrift.rb
@raecoo
raecoo / install-comodo-ssl-cert-for-nginx.rst
Created March 6, 2018 02:19 — 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