Skip to content

Instantly share code, notes, and snippets.

View jpfuentes2's full-sized avatar

Jacques Fuentes jpfuentes2

  • Chime
  • Richmond, VA
View GitHub Profile
@jpfuentes2
jpfuentes2 / rbenv-install-system-wide.sh
Created March 8, 2012 19:47
CentOS: rbenv install and system wide install
#!/bin/bash
# CentOS rbenv system wide installation script
# Forked from https://gist.github.com/1237417
# Installs rbenv system wide on CentOS 5/6, also allows single user installs.
# Install pre-requirements
yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel \
make bzip2 autoconf automake libtool bison iconv-devel git-core
@jpfuentes2
jpfuentes2 / Dockerfile
Last active October 16, 2018 17:59
dropping_the_d_in_ACID
FROM postgres:9.6-alpine
LABEL version="9.6"
LABEL author="jpfuentes2@gmail.com"
RUN apk update && apk upgrade --available
RUN apk add build-base git postgresql-dev
ENV POSTGRES_VERSION=9.6
@jpfuentes2
jpfuentes2 / reactjs.md
Last active September 15, 2016 09:32
Why and intros to React.js

Pushodoro

Pushodoro combines the Pomodoro Technique with a quick and simple calisthenics routine, starting with push-ups, to get your butt in shape.

We're killing ourselves

The awful truth: we sit on our butts toiling away at computers far too long -- and it's killing us. It makes us unhealthy, stupid, and we're 40% more likely to die within 15 years. The benefits from 30 minutes of rigorous exercise is completely erased if you sit for 6 hours.

Let's fix this problem

@jpfuentes2
jpfuentes2 / match.rb
Created January 22, 2014 03:44
Horribly inefficient, mostly incorrect, and underwhelming pattern matching in Ruby
class Any; end;
class Pattern
attr :values
def initialize(*args)
@values = args
@matchers = []
end
@jpfuentes2
jpfuentes2 / clojure_lists_and_maps.clj
Created December 24, 2013 19:58
Clojure example of lightweight data modelling - based on https://gist.github.com/amontalenti/8114383
(doseq [item '(1 2 3 4)]
(println item))
(doseq [[k v] {:ST "started", :IP "in progress", :DN "done"}]
(println (str k " => " v)))
irb(main):001:0> require 'msgpack'
=> true
irb(main):002:0> msg = {Command: "Handshake", Seq: 0}
=> {:Command=>"Handshake", :Seq=>0}
irb(main):003:0> msg = MessagePack.pack(msg)
=> "\x82\xA7Command\xA9Handshake\xA3Seq\x00"
irb(main):004:0> MessagePack.unpack(msg)
=> {"Command"=>"Handshake", "Seq"=>0}
# client = MarilynRPC::NativeClient.connect_tcp('localhost', 7373)
@jpfuentes2
jpfuentes2 / Vagrantfile
Last active December 28, 2015 18:59
Latest stable docker + Ubuntu Precise (12.04) 64bit
#!/usr/bin/env ruby
# -*- mode: ruby -*-
# vi: set ft=ruby :
def machine_exists?
!Dir.glob("#{File.dirname(__FILE__)}/.vagrant/machines/default/*/id").empty?
end
Vagrant::Config.run do |config|
#!/usr/bin/env ruby
require "clap"
@branch = "master"
@remote = "production"
Clap.run ARGV,
"--branch" => ->(b) { @branch = b },
"--remote" => ->(e) { @remote = e }
(ns labrepl.ipd)
;; moves and utils
(defn defect [moves] (conj moves 0))
(defn coop [moves] (conj moves 1))
(defn defect? [move] (= move 0))