Skip to content

Instantly share code, notes, and snippets.

View mafernando's full-sized avatar
🌻

Michael Fernando mafernando

🌻
  • San Francisco, California
View GitHub Profile
@mafernando
mafernando / corncharts.md
Last active November 22, 2016 23:02
CornCharts
##########################################################################################
;

# raw_corn table schema
CREATE TABLE `raw_corn` (
  `domain_code` varchar(4) DEFAULT NULL,
  `domain` varchar(30) DEFAULT NULL,
  `area_code` int(11) DEFAULT NULL,
  `area_name` varchar(30) DEFAULT NULL,
@mafernando
mafernando / gist:b6a4da5a750fb1f630acf6f4da21dbc4
Last active November 17, 2016 09:58 — forked from bryhal/gist:4129042
MYSQL: Generate Calendar Table
;
DROP TABLE IF EXISTS dates;
CREATE TABLE dates (
id INTEGER PRIMARY KEY, -- year*10000+month*100+day
date DATE NOT NULL,
year INTEGER NOT NULL,
month INTEGER NOT NULL, -- 1 to 12
day INTEGER NOT NULL, -- 1 to 31
quarter INTEGER NOT NULL, -- 1 to 4
week INTEGER NOT NULL, -- 1 to 52/53
@mafernando
mafernando / DockerNotes1.md
Last active August 11, 2016 16:23
DockerNotes1

Access CentOS Shell from Docker Conatiner

# docker run -it -p 8000:8000 -p 8080:8080 mafernando/forgerock:latest /bin/bash
docker run -it centos:7.2.1511 /bin/bash
@mafernando
mafernando / ubuntu_14_lts_setup.md
Last active July 11, 2016 22:32
ubuntu_14_lts_setup.md
# sudo ntpdate ntp.ubuntu.com

sudo apt-get install linux-image-extra-$(uname -r)
sudo apt-get install apparmor

sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
nano /etc/apt/sources.list.d/docker.list
@mafernando
mafernando / useful_unix.md
Created January 20, 2016 21:37
Useful Unix

Finding stuff with top:

(Note that the 1 indicates the number of times to take a sample)

C02MW21AFD59:cc-portal michaelfernando$ top -l 1 | grep ruby
83441  ruby             0.0  00:59.84 2     0   8+     264+   113M+  100M+  0B     0B    127M+  2554M+ 83440 1     sleeping 501 246375+   24001+  13+        4+         1964300+  36+       8340+      0       457K+  32K+   334     0.0   michaelfernando
83439  ruby             0.0  00:59.96 2     0   8+     268+   115M+  103M+  0B     0B    131M+  2558M+ 83438 1     sleeping 501 233596+   24079+  8+         4+         1967378+  36+       8641+      0       462K+  38K+   295     0.0   michaelfernando
83437  ruby             0.0  00:59.09 2     0   8+     285+   128M+  117M+  0B     0B    165M+  2586M+ 83436 1     sleeping 501 261641+   25082+  16+        4+         1963939+  91+       6608+      2+      582K+  83K+   402     0.0   michaelfernando
83435  ruby             0.0  00:58.69 2     0   8+     281+   127M+  115M+  0B     0B    161M+  2582M+ 83434 1   
@mafernando
mafernando / pry_routes_grep.md
Created January 7, 2016 18:51
Using Pry to show routes with grep
pry(main)> show-routes --grep admin
    admin_posts   GET    /admin/posts(.:format)           admin/posts#index
    admin_posts   POST   /admin/posts(.:format)           admin/posts#create
edit_admin_post   GET    /admin/posts/:id/edit(.:format)  admin/posts#edit
...
@mafernando
mafernando / rake_production.md
Created November 19, 2015 15:18
Running Rake in Production

That is the way it is intended to be. To create the production database do:

RAILS_ENV=production rake db:create

Also, have a look at rake db:setup which will run anything you put in db/seeds.rb.

@mafernando
mafernando / git_stuff.md
Last active July 6, 2016 16:37
Useful Git Commands
@mafernando
mafernando / RHEL-SETUP.md
Created October 26, 2015 20:57
RHEL Setup
sudo yum install httpd
sudo systemctl start httpd.service

Apache Logs can be found at:

  • var/log/httpd/access_log