Skip to content

Instantly share code, notes, and snippets.

View cristianounix's full-sized avatar
👨‍🚀
Focusing

Cristiano Oliveira cristianounix

👨‍🚀
Focusing
View GitHub Profile

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname

List commands supported by Rake:

  • rake db:fixtures:load - Load fixtures into the current environment's database. Load specific fixtures using FIXTURES=x,y
  • rake db:migrate - Migrate the database through scripts in db/migrate. Target specific version with VERSION=x
  • rake db:schema:dump - Create a db/schema.rb file that can be portably used against any DB supported by AR.
  • rake db:schema:load - Load a schema.rb file into the database.
  • rake db:sessions:clear - Clear the sessions table.
  • rake db:sessions:create - Creates a sessions table for use with CGI::Session::ActiveRecordStore.
  • rake db:structure:dump - Dump the database structure to a SQL file.
  • rake db:test:clone - Recreate the test database from the current environment's database schema.
@cristianounix
cristianounix / Install+Rbenv+Ngix+Passenger.md
Last active August 29, 2015 14:03
Install Rbenv+Ngix+Passenger
@cristianounix
cristianounix / Vagrantfile
Created August 28, 2014 16:16
This file was based in vaprobash
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Config Github Settings
github_username = "fideloper"
github_repo = "Vaprobash"
github_branch = "1.0.1"
github_url = "https://raw.githubusercontent.com/#{github_username}/#{github_repo}/#{github_branch}"
# Server Configuration
@cristianounix
cristianounix / tcp-client-and-server.js
Created January 27, 2015 16:15
TCP Client and Server
====== TCP Server =====
var net = require('net');
var HOST = '127.0.0.1';
var PORT = 6969;
// Create a server instance, and chain the listen function to it
// The function passed to net.createServer() becomes the event handler for the 'connection' event
// The sock object the callback function receives UNIQUE for each connection
@cristianounix
cristianounix / QSQlite3
Last active August 29, 2015 14:23 — forked from daltheman/QSQlite3
//
// QSQLite3.swift
// SQLiteWrapper
//
// Created by Danilo Altheman on 24/06/15.
// Copyright © 2015 Quaddro - Danilo Altheman. All rights reserved.
/* Usage:
// Open or create a Database
let database = QSQLite3(path: NSHomeDirectory() + "/Documents/database.sqlite")
var http = require("http");
var fs = require("fs");
var index = fs.readFileSync("index.html");
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test');
var db = mongoose.connection;
@cristianounix
cristianounix / osx-setup-php-mysql-postgre.md
Last active December 22, 2015 06:07
OSX Setup - PHP + MySql + Postgre

install php

with mysql pgsql intl support

$ brew install php --with-apache --with-mysql --with-pgsql --with-intl

set php timezone in php ini

date.timezone = Europe/Vienna
/*
DESCRIPTION
-----------
Use NodeJS to read RFID ids through the USB serial stream. Code derived from this forum:
http://groups.google.com/group/nodejs/browse_thread/thread/e2b071b6a70a6eb1/086ec7fcb5036699
CODE REPOSITORY
---------------
https://gist.github.com/806605
// Requires: http://cloud.github.com/downloads/harthur/brain/brain-0.6.0.js
// Contrived example using string "0" as output.
var net = new brain.NeuralNetwork();
net.train([{input: [0, 0], output: {"F":1}},
{input: [0, 1], output: {"1":1}},
{input: [1, 0], output: {"1":1}},
{input: [1, 1], output: {"0":1}}]);