Skip to content

Instantly share code, notes, and snippets.

View federico-garcia's full-sized avatar

Federico Garcia federico-garcia

  • Propelus
View GitHub Profile

Contributing to open source projects

Fork the project to your github account

Clone the project to you local environment

git clone ssh_string local_directory

tmux

Creating a new session

tmux
tmux new-session -s'my rails project'

The default prefix is ctrl+b, I will refer to this as the PREFIX, then you need to enter the command.

Leaving the current session (deattaching from session, it will continue running on the server).

Redis

Redis stands for REmote DIctionary Server. By default, redis stores all data in memory. It's a key-structure database. redis-server is the actual datastore. redis-cli is the command line interface that performs any redis command. By default, redis binds to port 6379.

Starting the redis server

redis-server

While you can build a complete system using Redis only, I think most people will find that it supplements their more generic data solution - whether that be a traditional relational database, a document-oriented system, or something else. It’s the kind of solution you use to implement specific features.

@federico-garcia
federico-garcia / mongoDB.md
Last active April 15, 2020 12:51
MongoDB guide

Running mongodb

docker run -d -v $(pwd)/data/single:/data/db -v $(pwd)/config/single/mongod.conf:/etc/mongod.conf -p 27017:27017 --name mongo-server mongo:3.4 mongod -f /etc/mongod.conf

mongod - the server itself
mongo - mongodb cli (you can run js scripts)

default data directory: /data/db default DB: test default port: 27017 (config parameter net:port anf net:bindIp)

cyclic redundancy check. crc32 is supposed to be faster than shasum, you should only use shasum if the output of crc32 for two files is equal, otherwise, you are safe to say the two files are not equal.

crc32 /path/to/file
md5 file.iso
md5 /path/to/file

shasum -a 1 file.iso
@federico-garcia
federico-garcia / oracle-troubleshooting.md
Last active July 18, 2017 16:29
Oracle Troubleshooting

Oracle

Are there any sessions blocking other sessions in the DB? Blocking session is the cause of lot of ACTIVE sessions in the DB and represent 2 or more sessions trying to touch the same data. We need to avoid this situation.

SELECT s1.username || '@' || s1.machine
    || ' ( SID=' || s1.sid || ' )  is blocking '
    || s2.username || '@' || s2.machine || ' ( SID=' || s2.sid || ' ) ' AS blocking_status,
    st1.sql_text statment_1,
    st2.sql_text statment_2  
    FROM v$lock l1, v$session s1, v$lock l2, v$session s2, sys.v_$sql st1, sys.v_$sql st2
@federico-garcia
federico-garcia / consul.md
Last active September 27, 2020 17:53
Getting started with Consul

Consul

Consul provides a solution to the following challenges:

  • Service Discovery. It acts as an internal DNS server. No more internal load balancers?
  • Failure Detection. Health checking. It automatically removes failed nodes and services from the DNS response it gives to clients. Consul runs an agent in each server which are in charge of the health of all local services, by doing this, it distribute the health checking task. Agents talk to each other to share information about the services/nodes they are monitoring, adding or removing nodes or services as they become available or start failing.
  • Multi Datacenter. Consul is multi datacenter aware so you can have services available in multiple datacenters but using consul you can connect to locally deployed services in the same datacenter where the request is being originated, instead of going to the other datacenter for no reason. Datacenter is a logical concept. Talks to local services first and failover to ther datacenters if it needs to.
@federico-garcia
federico-garcia / consul-glossary.md
Created July 20, 2017 13:29 — forked from g0t4/glossary.md
Consul and related terms
  • Node - a physical or virtual machine that hosts services
    • Nodes also referred to as members.
    • Examples
      • Your computer
      • An AWS EC2 instance
      • A bare metal machine in your private data center
  • Service - executing software that provides utility via an interface
    • Typically long-lived process listening on a port(s)
    • Examples
  • A web server (nginx, apache, iis)
@federico-garcia
federico-garcia / kubernetes-app-development-guide.md
Last active December 6, 2021 20:43
kubernetes tooling, app development and deployment

Concepts

Cloud Native apps = cloud + orchestration + containers

Local k8s cluster

Installing a k8s cluster on your machine

-- install k8s cli-tool kubectl for sending commands to k8s API server
-- you may want to alias kubectl to something shorter like k. Add alias k=kubectl 
-- in your bash|zsh profile