Skip to content

Instantly share code, notes, and snippets.

View dkobia's full-sized avatar

David Kobia dkobia

View GitHub Profile
@dkobia
dkobia / dropbox-fix-conflicts
Last active December 6, 2019 18:15 — forked from rswgnu/dropbox-fix-conflicts
Recursively moves and replaces conflicted Dropbox files keeping the newer one of each pair. After that is done, it searches for conflicting files and optionally removes those as well.
#!/bin/bash
# Description: Recursively moves and replaces conflicted Dropbox files keeping the newer one of each pair
# Usage: <script-name> - Shows what files would be moved and replaced but does not do any replacements
<script-name> replace - Performs file replacements
# Based on: http://mechanicalscribe.com/notes/fix-dropbox-conflicts-automatically/
# Thx, http://stackoverflow.com/questions/20723868/batch-rename-dropbox-conflict-files
@dkobia
dkobia / athena_cheatsheet.md
Last active February 6, 2019 11:02 — forked from steveodom/athena_cheatsheet.md
AWS Athena / Hive / Presto Cheatsheet

Useful Links / Sources

Housekeeping

change column type

ALTER TABLE logs.trades CHANGE recentprice price int;
@dkobia
dkobia / readme.md
Created April 13, 2018 02:22 — forked from yosukehasumi/readme.md
DigitalOcean Rails/Ubuntu/NGINX (16.04) Setup

DigitalOcean Rails/Ubuntu/NGINX (16.04) Setup

  1. Setup
  2. Swapfile
  3. NGINX
  4. ElasticSearch
  5. RVM
  6. Rails
  7. Postgres
  8. Capistrano
@dkobia
dkobia / .dockerignore
Created April 12, 2018 18:13 — forked from davidderus/.dockerignore
Docker + Rails + Puma + Postgres + Nginx
.git
.gitignore
/doc
.yardoc
coverage
jsdoc
/tmp
/log
Dockerfile
Dockerfile.prod
@dkobia
dkobia / DockerFile_app
Created April 12, 2018 16:51 — forked from satendra02/app.DockerFile
docker+rails+puma+nginx+postgres (Production ready)
FROM ruby:2.3.1
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
# Configuring main directory
RUN mkdir -p /app_name
WORKDIR /app_name
# Setting env up
ENV RAILS_ENV='production'
ENV RAKE_ENV='production'
@dkobia
dkobia / psql-with-gzip-cheatsheet.sh
Created February 12, 2018 23:44 — forked from brock/psql-with-gzip-cheatsheet.sh
Exporting and Importing Postgres Databases using gzip
# This is just a cheat sheet:
# On production
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz
# On local
scp -C production:~/database.sql.gz
dropdb database && createdb database
gunzip < database.sql.gz | psql database

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.
@dkobia
dkobia / self-signed-certificate-with-custom-ca.md
Last active December 1, 2019 07:46 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@dkobia
dkobia / dynamodbLocal.md
Created May 25, 2017 20:27
Easy DynamoDB Local Environment (Mac OSX / Linux)

Set Up DynamoDB

  • Get DynamoDB
$ wget http://dynamodb-local.s3-website-us-west-2.amazonaws.com/dynamodb_local_latest.tar.gz
  • Unzip
$ gunzip dynamodb_local_latest.tar.gz
@dkobia
dkobia / clamav-mac.md
Last active February 7, 2017 20:41 — forked from Uchean/clamav-mac.md
Get ClamAV running on Mac OS X (using Homebrew)

Get ClamAV running on Mac OS X (using Homebrew)

The easiest way to get the ClamAV package is using Homebrew

$ brew install clamav

Before trying to start the clamd process, you'll need a copy of the ClamAV databases.

Create a freshclam.conf file and configure as so