Skip to content

Instantly share code, notes, and snippets.

View felipekm's full-sized avatar
🦈

Felipe Kautzmann felipekm

🦈
View GitHub Profile
@felipekm
felipekm / npm_globally_without_sudo.md
Created April 5, 2018 11:51
Install `npm` packages globally without sudo on macOS and Linux

Install npm packages globally without sudo on macOS and Linux

npm installs packages locally within your projects by default. You can also install packages globally (e.g. npm install -g <package>) (useful for command-line apps). However the downside of this is that you need to be root (or use sudo) to be able to install globally.

Here is a way to install packages globally for a given user.

1. Create a directory for global packages
mkdir "${HOME}/.npm-packages"
@felipekm
felipekm / docker_without_sudo.md
Created April 5, 2018 11:51
Run Docker commands without sudo

Run Docker commands without sudo

1. Add the docker group if it doesn't already exist
$ sudo groupadd docker
2. Add the connected user $USER to the docker group
@felipekm
felipekm / ecr_build_push.md
Last active April 6, 2018 18:07
ECR - Build, tag, and push Docker image

1) Retrieves the docker login command that you can use to authenticate your Docker client to your registry

aws ecr get-login --no-include-email --region sa-east-1

1.1) Copy the response content docker login... and run it before next step

2) Build your Docker image using the following command

docker build -t pling-docker .

3) After the build completes, tag your image so you can push the image to this repository

docker tag : .dkr.ecr..amazonaws.com/:

@felipekm
felipekm / reinstall_git_macosx_brew.md
Created April 6, 2018 17:34
Re-installing Git on Mac OSX with Brew

Re-installing Git on Mac OSX with Brew

This is helpful if you've previously installed git from source on OSX, and other compilers can't find the correct path. You need to remove the current version of git, then re-install with brew.

Uninstall git if installed manually

  1. Check which git you're running:
    which git
    
@felipekm
felipekm / benchmark.sh
Last active April 10, 2018 14:05
Test-load the server with 200 concurrent connections for 10 seconds.
ab -c200 -t10 http://localhost:8080/
@felipekm
felipekm / revert.sh
Created April 10, 2018 23:43
GIT - how to revert to specific commit
git revert --no-commit {SHA_COMMIT}..HEAD && git add --all && git commit -m "revert"
@felipekm
felipekm / mysql_osx.md
Created April 12, 2018 16:13
How to START|STOP mysql server in OSX

Start MySQL

sudo /usr/local/mysql/support-files/mysql.server start

Stop MySQL

sudo /usr/local/mysql/support-files/mysql.server stop

Restart MySQL

sudo /usr/local/mysql/support-files/mysql.server restart

@felipekm
felipekm / launch.json
Last active March 29, 2019 21:04
vs code debug with bunyan
// install dependency then create a script file with this code:
// #!/bin/bash
// node $* | node_modules/bunyan/bin/bunyan
// make it executable (chmod u+x scriptFile) and set your vscode launch.json as below
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
@felipekm
felipekm / revert.sh
Created June 11, 2018 19:06
Git - revert to specific commit
# Resets index to former commit; replace '56e05fced' with your commit code
git reset 56e05fced
# Moves pointer back to previous HEAD
git reset --soft HEAD@{1}
git commit -m "Revert to 56e05fced"
# Updates working copy to reflect the new commit
git reset --hard
@felipekm
felipekm / format_json_python.sh
Created June 12, 2018 13:22
Format JSON with python
#!bin/sh
echo '{"ae": 1}' | python -m json.tool