Skip to content

Instantly share code, notes, and snippets.

View pmutua's full-sized avatar
🐲
You are awesome make things happen ✨

Philip Mutua pmutua

🐲
You are awesome make things happen ✨
View GitHub Profile
@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)
@pmutua
pmutua / test.py
Created June 18, 2018 08:02 — forked from andresriancho/test.py
Test compression algorithms
import timeit
import lz4.frame
import lzf
import zlib
#import snappy
import os
from timeit import Timer
DATA = open("test.py", "rb").read()
DLEN = len(DATA)
@pmutua
pmutua / tmux-cheatsheet.markdown
Created June 21, 2018 06:13 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@pmutua
pmutua / test_image_upload.py
Created June 26, 2018 08:57 — forked from guillaumepiot/test_image_upload.py
Django Rest Framework - Image/File upload test
import os
import io
from PIL import Image
from django.core.urlresolvers import reverse
from django.conf import settings
from rest_framework import status
from rest_framework.test import APITestCase
## SETTINGS
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
## MODEL
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Logo(models.Model):
@pmutua
pmutua / RAILS_5_CHEATSHEET.md
Created July 12, 2018 08:22 — forked from harrietty/RAILS_5_CHEATSHEET.md
Ruby on Rails 5 Cheatsheet

Ruby on Rails Cheatsheet (5.1)

Architecture

RVM

$ rvm list - show currently installed Rubies

@pmutua
pmutua / update-golang.md
Created July 18, 2018 09:14 — forked from nikhita/update-golang.md
How to update the Go version

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by:

@pmutua
pmutua / 100Doors.py
Created July 20, 2018 08:50
100 Doors Problem
'''
100 Doors Problem:
There are 100 doors in a row that are all initially closed.
You make 100 passes by the doors.
The first time through, visit every door and toggle the door (if the door is closed, open it; if it is open, close it).
The second time, only visit every 2nd door (door #2, #4, #6, ...), and toggle it.
The third time, visit every 3rd door (door #3, #6, #9, ...), etc, until you only visit the 100th door.
Task:
Answer the question: what state are the doors in after the last pass? Which are open, which are closed?
@pmutua
pmutua / golang_setup
Created July 25, 2018 10:39 — forked from xXPhenomXx/golang_setup
Go Setup on Ubuntu & Revel
** To install Golang on Ubuntu 17.xx server **
sudo add-apt-repository ppa:gophers/archive
sudo apt-get update
sudo apt-get install golang-1.9-go
export PATH=$PATH:/usr/lib/go-1.9/bin
go version (To verify its mapped correctly, should see something like: go version go1.9.2 linux/amd64)
* make a directory for your go applications, I use /home/apps/go
export GOPATH=/home/apps/go
(Now from inside your /home/apps/go folder you can start creating your go apps)
@pmutua
pmutua / index.md
Created August 4, 2018 08:00
Creating Login, Register page with Ionic

Create new Ionic project with blank template

ionic start login blank
cd login
ionic g provider authService
ionic g page register
ionic g page login