Skip to content

Instantly share code, notes, and snippets.

View mekicha's full-sized avatar
🎯
Focusing

Emeka Icha mekicha

🎯
Focusing
  • Sennder GmbH
  • Germany
View GitHub Profile
@mekicha
mekicha / util.md
Created February 16, 2018 08:04
a gist of command line utilities i don't want to google every time.

MTR(Matt's TraceRoute) MTR combines the functions of both the standard programs ping and traceroute. Like ping, it sends ICMP requests to a destination, either a domain name or an IP address, and listens for the destination to answer back. Like Traceroute, it also works by setting the Time To Live (TTL), or the number of maximum hops a packet can take over the network, to a low number, increasing with each attempt. This determines the route packets are taking to a destination along the way. The information will update continuously for as long as MTR runs. source

Install

sudo apt-get install mtr

@mekicha
mekicha / flask_profiler.py
Created February 19, 2018 11:52 — forked from shreyansb/flask_profiler.py
A profiler for Flask apps
"""
This module provides a simple WSGI profiler middleware for finding
bottlenecks in web application. It uses the profile or cProfile
module to do the profiling and writes the stats to the stream provided
To use, run `flask_profiler.py` instead of `app.py`
see: http://werkzeug.pocoo.org/docs/0.9/contrib/profiler/
and: http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xvi-debugging-testing-and-profiling
"""
@mekicha
mekicha / rabbitmq.md
Last active May 2, 2018 11:16
rabbitmq installation on ubuntu

Install Erlang

wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb

sudo dpkg -i erlang-solutions_1.0_all.deb

sudo apt-get update

sudo apt-get install erlang erlang-nox

Install RabbitMQ Server

Ways to copy your ssh keys from local machine to a remote server

  1. ssh-copy-id username@remote_host

  2. cat ~/.ssh/id_rsa.pub | ssh username@remote_host "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

Add user to sudoers list

For an existing user. sudo usermod -a -G sudo <username>

Install android studio on Ubuntu Server

Use Ubuntu umake Like this:

install ubuntu umake

sudo add-apt-repository ppa:ubuntu-desktop/ubuntu-make

sudo apt update

sudo apt install ubuntu-make

@mekicha
mekicha / linux.md
Created March 1, 2018 14:24
copied from udacity linux course for easy reference.

/etc/passwd This is a very important file on your system! It's used to keep track of all users on the system. Run cat /etc/passwd and look at the output; each line is organized in this format:

username:password:UID:GID:UID info:home directory:command/shell

Let’s run through what each of those mean:

username: the user’s login name password: the password, will simply be an x if it’s encrypted user ID (UID): the user’s ID number in the system. 0 is root, 1-99 are for predefined users, and 100-999 are for other system accounts

Install pyenv

pyenv is similar to nvm in the Nodejs community. It allows to install, manage, and switch between multiple Python versions.

curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash

And add these three lines to .bash_profile or .bashrc.

  eval "$(pyenv init -)"
 eval "$(pyenv virtualenv-init -)"
@mekicha
mekicha / config.md
Last active March 12, 2018 09:07
NGINX CONFIGURATION FILE FOR A DJANGO API SERVER, WITH FLOWER-CELERY MONITORING AND RABBITMQ ADMIN INTERFACE ACCESS
server {
    listen 80;
    server_name ip_or_domain_name;
    client_max_body_size 256m;
    location = /favicon.ico { access_log off; log_not_found off; }

    location /static/ {
        alias /path/to/staticfiles/dir;
    }

What is redis

Redis is an in-memory remote database that offers high performance, replication, and a unique data model to produce a platform for solving problems.

Redis is a very fast non-relational database that stores a mapping of keys to five different types of values.

Redis supports 5 types of data structure:

STRING

contains: Strings, integers, or floating-point values

Install using pipenv

pipenv install coverage --dev

Run coverage

coverage run --source='.' manage.py test

Generate a html report

coverage html

Or if you prefer to see report on the command line