Skip to content

Instantly share code, notes, and snippets.

CREATE EXTERNAL TABLE cloudtrail_logs (
eventversion STRING,
userIdentity STRUCT<
  type:STRING,
  principalid:STRING,
  arn:STRING,
  accountid:STRING,
  invokedby:STRING,
  accesskeyid:STRING,
userName:STRING,
@jaisingh
jaisingh / encrypt_openssl.txt
Created May 24, 2018 04:34 — forked from crazybyte/encrypt_openssl.txt
File encryption using OpenSSL
For symmetic encryption, you can use the following:
To encrypt:
openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt
To decrypt:
openssl aes-256-cbc -salt -a -d -in encrypted.txt -out plaintext.txt
For Asymmetric encryption you must first generate your private key and extract the public key.

Keybase proof

I hereby claim:

  • I am jaisingh on github.
  • I am jaisingh (https://keybase.io/jaisingh) on keybase.
  • I have a public key ASB1OJ_Ha5SwFLzGXNCGKCAta8UUm_5GbnpckNZWG5oO2Qo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am jaisingh on github.
  • I am jaisingh (https://keybase.io/jaisingh) on keybase.
  • I have a public key ASCc9xcMpb94uMm-TS-jlqhNkbbnhRPX-qY_QziwXqP65Ao

To claim this, I am signing this object:

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
package main
import (
"fmt"
"io"
"log"
"net/http"
"net/http/fcgi"
"os"
"runtime"
#!/usr/bin/env ruby
require 'redis'
require 'hiredis'
require 'digest/sha1'
require 'benchmark'
def new_digest
Digest::SHA1.hexdigest( Time.now.strftime("%9N").to_s )
end
example-ruby-sinatra (master)]$ git push deis master
Counting objects: 102, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (53/53), done.
Writing objects: 100% (102/102), 22.19 KiB | 0 bytes/s, done.
Total 102 (delta 43), reused 102 (delta 43)
-----> Ruby app detected
-----> Compiling Ruby/Rack
-----> Using Ruby version: ruby-1.9.3
-----> Installing dependencies using 1.6.3
@jaisingh
jaisingh / file_provider_copy.rb
Created January 27, 2012 06:02 — forked from scottedsa/file_provider_copy.rb
Stick this in a library file...
class Chef
class Provider
class File
class Copy < Chef::Provider::File
def compare_content
checksum(@current_resource.path) == checksum(@new_resource.content)
end
def set_content
@jaisingh
jaisingh / nagios_check.rb
Created May 3, 2011 21:52
nagios check class
class NagiosCheck
OK,WARN,CRIT,UNKNOWN = 0,1,2,3
OK_STR = "OK"
WARN_STR = "WARNING"
CRIT_STR = "CRITICAL"
UNKNOWN_STR = "UNKNOWN"
attr_reader :exit_code
attr_writer :exit_str
attr_accessor :perfdata, :outputdata