Skip to content

Instantly share code, notes, and snippets.

@npearce
npearce / install-docker.md
Last active Jul 25, 2021
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command
View install-docker.md

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: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
@bradtraversy
bradtraversy / docker-help.md
Last active Jul 24, 2021
Docker Commands, Help & Tips
View docker-help.md

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@asugai
asugai / Install composer on Amazon AMI running on EC2
Last active Jul 22, 2021
Install composer on Amazon AMI running on EC2
View Install composer on Amazon AMI running on EC2
$ cd ~
$ sudo curl -sS https://getcomposer.org/installer | sudo php
$ sudo mv composer.phar /usr/local/bin/composer
$ sudo ln -s /usr/local/bin/composer /usr/bin/composer
then you can run
$ sudo composer install
@thiagomarini
thiagomarini / readme.sh
Created Oct 29, 2018
How to install supervisor on Amazon Linux
View readme.sh
# 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
@irazasyed
irazasyed / Install Composer using MAMP's PHP.md
Last active Jul 13, 2021
Instructions on how to change preinstalled Mac OS X PHP to MAMP's PHP Installation and then install Composer Package Management
View Install Composer using MAMP's PHP.md

Change default Mac OS X PHP to MAMP's PHP Installation and Install Composer Package Management


Instructions to Change PHP Installation


First, Lets find out what version of PHP we're running (To find out if it's the default version).

To do that, Within the terminal, Fire this command:

which php
@joecliff
joecliff / cryptojs_base64_encrypt_decrypt.js
Last active Jul 12, 2021
An example of base64 usage in cryptojs
View cryptojs_base64_encrypt_decrypt.js
var CryptoJS = require("crypto-js");//replace thie with script tag in browser env
//encrypt
var rawStr = "hello world!";
var wordArray = CryptoJS.enc.Utf8.parse(rawStr);
var base64 = CryptoJS.enc.Base64.stringify(wordArray);
console.log('encrypted:', base64);
//decrypt
var parsedWordArray = CryptoJS.enc.Base64.parse(base64);
@ebaranov
ebaranov / gist:41bf38fdb1a2cb19a781
Created Sep 27, 2014
Country - state list in JSON
View gist:41bf38fdb1a2cb19a781
{
"countries": [
{
"country": "Afghanistan",
"states": ["Badakhshan", "Badghis", "Baghlan", "Balkh", "Bamian", "Daykondi", "Farah", "Faryab", "Ghazni", "Ghowr", "Helmand", "Herat", "Jowzjan", "Kabul", "Kandahar", "Kapisa", "Khost", "Konar", "Kondoz", "Laghman", "Lowgar", "Nangarhar", "Nimruz", "Nurestan", "Oruzgan", "Paktia", "Paktika", "Panjshir", "Parvan", "Samangan", "Sar-e Pol", "Takhar", "Vardak", "Zabol"]
},
{
"country": "Albania",
"states": ["Berat", "Dibres", "Durres", "Elbasan", "Fier", "Gjirokastre", "Korce", "Kukes", "Lezhe", "Shkoder", "Tirane", "Vlore"]
},
@mbrochh
mbrochh / 01_utils.py
Last active Jul 3, 2021
Using pagination with Django, graphene and Apollo
View 01_utils.py
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)
try:
page_obj = p.page(page)
except PageNotAnInteger:
@irazasyed
irazasyed / homebrew-permissions-issue.md
Last active Jun 29, 2021
Homebrew: Permissions Denied Issue Fix (OS X / macOS)
View homebrew-permissions-issue.md

Homebrew Permissions Denied Issues Solution

sudo chown -R $(whoami) $(brew --prefix)/*