Skip to content

Instantly share code, notes, and snippets.

View rtorino's full-sized avatar

Raymond Torino rtorino

  • 8x8, Inc.
  • Cebu City, Philippines
View GitHub Profile
@rtorino
rtorino / db.go
Created May 19, 2016 06:09 — forked from SchumacherFM/db.go
GoLang Database SQL: Selecting an unknown amount of columns from a query. Benchmark results in db_test.go
package main
import (
"database/sql"
"fmt"
_ "github.com/go-sql-driver/mysql"
"log"
)
const (
@rtorino
rtorino / remove-docker-containers.md
Created April 7, 2016 07:18 — forked from ngpestelos/remove-docker-containers.md
How to remove unused Docker containers and images
  1. Delete all containers

     $ docker ps -q -a | xargs docker rm
    

-q prints only the container IDs -a prints all containers

Notice that it uses xargs to issue a remove container command for each container ID

  1. Delete all untagged images

TL;DR

Meteor is great at sharing code between different builds for different platforms. You can use the same source for your browser builds, server builds, your builds for iOS, Android, ... But how to organize your project to be able to orchestrate your builds for different apps and services from the same source? This post elaborates on the reasons why you need these different builds and how you could accomplish this with Meteor easily.

Use cases: Why would you build different apps?

1. Different apps for different roles

Say you have an app with completely different end user experiences depending on their role. It is common practice to have the user logged in, check her authorization (role) and then setup different routes or load different templates to serve that type of user’s needs. While doing so, all types of users load the same build and the app decides what portions of the build to use and what not to use.

@rtorino
rtorino / rds_to_docker.md
Created October 20, 2015 13:52 — forked from herval/rds_to_docker.md
Moving a Postgres db from RDS to a Docker container

Make a backup from RDS

pg_dump -h <rds host> -p 5432 -F c -O -U <rds user> <db name> > db.dump

Restore the backup into a Docker container

docker run --rm --interactive --link <postgres container id>:postgres --volume $PWD/:/tmp/ postgres:latest /bin/bash -c 'pg_restore --verbose --clean --no-acl --no-owner -h "$POSTGRES_PORT_5432_TCP_ADDR" -p "$POSTGRES_PORT_5432_TCP_PORT" -U postgres -d <db name> /tmp/db.dump'
{
"id": "",
"name": "",
"description": "",
"url": "",
"thumbnailUrl": "",
"type": "",
"tags": [],
"resources": {
"guideBook": {
{
"caret_extra_width": 2,
"color_scheme": "Packages/Colorcoder/Seti (Colorcoded) (SL) (Colorcoded).tmTheme",
"default_line_ending": "unix",
"detect_indentation": false,
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": false,
"file_exclude_patterns":
[
".DS_Store",
##Folder structure
/backbone
app.js
/apps
/entities
/lib
##Inside Apps
/apps
var gulp = require('gulp'),
connect = require('connect'),
http = require('http'),
open = require('open'),
rimraf = require('gulp-rimraf'),
jshint = require('gulp-jshint'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
sass = require('gulp-sass'),
minifycss = require('gulp-minify-css'),
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
*/
var http = require('http'),
fs = require('fs'),
util = require('util');
http.createServer(function (req, res) {
var path = 'video.mp4';
@rtorino
rtorino / tmux.conf
Created December 6, 2013 08:01 — forked from shinzui/tmux.conf
# ~/.tmux.conf
#
# See the following files:
#
# /opt/local/share/doc/tmux/t-williams.conf
# /opt/local/share/doc/tmux/screen-keys.conf
# /opt/local/share/doc/tmux/vim-keys.conf
#
# URLs to read:
#