Skip to content

Instantly share code, notes, and snippets.

View pmutua's full-sized avatar
🐲
Focus mode

Philip Mutua pmutua

🐲
Focus mode
  • Nairobi,Kenya
  • 07:27 (UTC +03:00)
View GitHub Profile
@pmutua
pmutua / Rakefile.rb
Created July 25, 2017 04:26 — forked from rkjha/Rakefile.rb
A simple rake file for deploying sinatra app.
### change APP_NAME and REPO ###
### Also replace example.com with your domain, it requires DNS setup, atleast a local entry in ssh-config or hosts file
require 'rake/remote_task'
set :domain, 'example.com'
set :app_name, 'APP_NAME'
set :repo, 'ssh://REPO'
namespace :deploy do
desc "Server setup"

Deploy a Sinatra App with Heroku

##What does this mean? Your web application - out there on the Internets for all to see! We are leaving your local development environment and heading into staging and production.

We develop our apps in many different "environments" and so far we have discussed and worked with our test environment and development environment.

To follow Agile Development Methodologies we aim to build out some functionality through testing locally, then do a release (i.e. deploy the app) and test it out in production. Once it's up we check to make sure it's running the way we expect - through QA-ing (quality assurance testing). In this stage we may also get feedback from clients or other teams. Next, we make changes and updates to those features, re-releasing the next iteration to test. Then, once those features are finished, we begin with the next set of functionality.

@pmutua
pmutua / github-pygments.css
Created August 6, 2017 08:36 — forked from thetallweeks/github-pygments.css
Pygments syntax highlighting from github
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #999988; font-style: italic } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #000000; font-weight: bold } /* Keyword */
.highlight .o { color: #000000; font-weight: bold } /* Operator */
.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #999999; font-weight: bold; font-style: italic } /* Comment.Preproc */
.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
@pmutua
pmutua / media-query.css
Created September 13, 2017 13:37 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@pmutua
pmutua / vimrc
Created October 11, 2017 06:56 — forked from lkurylo/vimrc
"disable compatibility mode with Vi
set nocompatible
filetype off
set rtp+=~/vimfiles/bundle/Vundle.vim
call vundle#begin('~/vimfiles/bundle')
"Plugin 'VundleVim/Vundle.vim'
Plugin 'bling/vim-airline'
@pmutua
pmutua / multi-git.md
Created November 29, 2017 12:52 — forked from rosswd/multi-git-win.md
Setting up a Github and Bitbucket account on the same computer.

Setting up github and bitbucket on the same computer

Github will be the main account and bitbucket the secondary.

Create SSH Keys

ssh-keygen -t rsa -C "github email"

Enter passphrase when prompted. If you see an option to save the passphrase in your keychain, do it for an easier life.

@pmutua
pmutua / tmux.md
Created May 3, 2018 05:07 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@pmutua
pmutua / compress_s3_images.py
Created May 3, 2018 09:40 — forked from rigoneri/compress_s3_images.py
Simple python code to compress (jpeg/png) images uploaded to S3. In this use case I want to compress down all images that are over 500 KB down to 80% quality which brings the images down to about 100KB. Feel free to muck with the values.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from boto.s3.connection import S3Connection
from cStringIO import StringIO
from PIL import Image as pil
AWS_KEY = '[AWS KEY HERE]'

Installation of Phoenix on Ubuntu 16.04

  • Don't use the Ubuntu packages provided, instead:
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 esl-erlang elixir
@pmutua
pmutua / bench.py
Created June 18, 2018 08:01 — forked from itdaniher/bench.py
python-blosc / python-lz4 profiling
import uuid
import timeit
import lz4
import os
from timeit import Timer
import sys
import blosc
DATA = open(sys.argv[1], "rb").read()
LZ4_DATA = lz4.block.compress(DATA)