Skip to content

Instantly share code, notes, and snippets.

View carloscarcamo's full-sized avatar
🏠
Working from home

Carlos Cárcamo carloscarcamo

🏠
Working from home
View GitHub Profile
@carloscarcamo
carloscarcamo / SQL-Movie-Rating.sql
Created June 13, 2016 18:08
My answers to SQL exercises for db-class.org /Part 1/
/* Delete the tables if they already exist */
drop table if exists Movie;
drop table if exists Reviewer;
drop table if exists Rating;
/* Create the schema for our tables */
create table Movie(mID int, title text, year int, director text);
create table Reviewer(rID int, name text);
create table Rating(rID int, mID int, stars int, ratingDate date);
@carloscarcamo
carloscarcamo / ip_forward.md
Created November 25, 2015 08:12 — forked from tzermias/ip_forward.md
Forward traffic from wlan0 to eth0 interface

Forward traffic from a laptop's eth0 to wlan0

###To laptop

Specify an IP address to eth0 (here 192.168.56.1)

sudo ifconfig eth0 192.168.56.1 netmask 255.255.255.0
@carloscarcamo
carloscarcamo / nginxproxy.md
Created November 10, 2015 16:21 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@carloscarcamo
carloscarcamo / docker-compose-daemon.sh
Created November 10, 2015 06:39 — forked from domachine/docker-compose-daemon.sh
run docker-compose in daemon mode and attach to web container
docker-compose up -d
docker attach myapp_web_1
@carloscarcamo
carloscarcamo / install_cgroup_debian_wheezy.sh
Last active September 15, 2015 17:43 — forked from lambdalisue/install_cgroup_debian_wheezy.sh
Install cgroup-bin in Debian Wheezy with a patch
#!/usr/bin/env bash
#==============================================================================
#
# Install cgroup-bin in Debian Wheezy
#
# The following required files in a cgroup-bin package of debian wheezy are
# missing. That's why this script get these files from a package of debian
# squeeze while original init.d scripts of cgroup were not regulated to use
# in debian system.
#
@carloscarcamo
carloscarcamo / README.md
Last active September 7, 2015 22:39 — forked from danasilver/README.md
Jekyll Pygments/Redcarpet Global Configs

Jekyll Pygments/Redcarpet Global Configs

A Jekyll plugin that enables global configuration options for Pygments.

  • Add pygments_global_config.rb to my-jekyll-project/_plugins/.

  • Add Pygments options to _config.yml

markdown: redcarpet
/*
* 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';
import csv
from collections import defaultdict
with open('/Users/adam/Downloads/languages-2014.csv', 'r') as f:
results_2014 = [row for row in csv.reader(f)][1:]
with open('/Users/adam/Downloads/languages-2013.csv', 'r') as f:
results_2013 = [row for row in csv.reader(f)][1:]
with open('/Users/adam/Downloads/languages-2012.csv', 'r') as f:
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
function ajaxCall(url, parameters, successCallback) {
$.ajax({
type: 'POST',
dataType: 'json', //la funccion success te devolvera un json
url: url,
data: parameters,
// See comments below.
// This code sample and justification brought to you by
// Isaac Z. Schlueter, aka isaacs
// standard style
var a = "ape",
b = "bat",
c = "cat",
d = "dog",