Skip to content

Instantly share code, notes, and snippets.

npearce /
Last active Oct 4, 2022
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See:

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
Kendysond / clean.php
Last active Oct 31, 2018
Clean any Nigerian Number format to be ready for sending SMS
View clean.php
function clean_number($phone_number){
$phone_number = preg_replace('/^0/','234',$phone_number);
$phone_number = preg_replace('/^\+/','',$phone_number);
return $phone_number;
// This should convert a number like 09023293092 or +2349023293092 to 2349023293092
thiagomarini /
Created Oct 29, 2018
How to install supervisor on Amazon Linux
# Install it as a yum package instead of throgh pip (will save you from lots of hassle)
# first get epel
sudo amazon-linux-extras install epel
# then install supervisor
sudo yum install supervisor
bradtraversy /
Last active Oct 3, 2022
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

mbrochh /
Last active Apr 13, 2022
Using pagination with Django, graphene and Apollo
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
# First we create a little helper function, becase we will potentially have many PaginatedTypes
# and we will potentially want to turn many querysets into paginated results:
def get_paginator(qs, page_size, page, paginated_type, **kwargs):
p = Paginator(qs, page_size)
page_obj =
except PageNotAnInteger:
ibrahimlawal / PaystackFee.js
Last active Mar 23, 2019
Add Paystack fees in Javascript
View PaystackFee.js
function PaystackFee() {
this.DEFAULT_THRESHOLD = 250000;
this.DEFAULT_CAP = 200000;
this.percentage = this.DEFAULT_PERCENTAGE;
this.additional_charge = this.DEFAULT_ADDITIONAL_CHARGE;
this.threshold = this.DEFAULT_THRESHOLD;
this.cap = this.DEFAULT_CAP;
ibrahimlawal /
Last active Nov 22, 2019
My PHP libraries Git hooks


  • php in your path
  • git
  • your php projects should have phpunit installed


  • download all files, rename them removing the .sh extension.
  • chmod +x each of them
  • copy git-mrm and git-ddev to a folder in your executable path e.g. /usr/local/bin
View Reseach

These are notes while researching a way to convert a browser/website to a stream. This could be used for Facebook Live or for webrecording. TL'DR:

  • I started with Phantomjs - but that didn't support the html5 video tag
  • SlimerJS supports it, but there is no way to record audio directly (though this might come from desktop audio)
  • So I moved to research ffmpeg/X11/XVFB to record it with linux which works
  • But ffmpeg has no easy way to mix streams/overlays to I moved on to OBS with overlay browser support
  • I started researching options OBS in docker and it needed best a GPU , so I move to nvidia-docker
  • And so came across building game servers on EC2/AWS using GPUs and managed to run OBS inside of GPU g2x.large machine
  • I tried streaming to twich , which works great and managed to restream 4K 60FPS youtube on an AWS instance
  • Remote control works through OBS-Remote but OBS has kinda limit in types of features
ibrahimlawal / PaystackFees.php
Last active Apr 6, 2020
A php class to add paystack's local charge to a transaction total. Totally flops if the user pays with a foreign card.
View PaystackFees.php
class PaystackFees
const DEFAULT_THRESHOLD = 250000;
const DEFAULT_CAP = 200000;
public static $default_percentage = PaystackFees::DEFAULT_PERCENTAGE;
krambertech / Component.jsx
Created Jul 2, 2016
ReactJS: Input fire onChange when user stopped typing (or pressed Enter key)
View Component.jsx
import React, { Component } from 'react';
import TextField from 'components/base/TextField';
const WAIT_INTERVAL = 1000;
const ENTER_KEY = 13;
export default class TextSearch extends Component {
constructor(props) {