Skip to content

Instantly share code, notes, and snippets.

Ishmael Doss (˃̵ᴗ˂̵) liverbool

Block or report user

Report or block liverbool

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@liverbool
liverbool / url_slug.php
Created Jul 11, 2016 — forked from sgmurphy/url_slug.php
URL Slugs in PHP (with UTF-8 and Transliteration Support)
View url_slug.php
<?php
/**
* Create a web friendly URL slug from a string.
*
* Although supported, transliteration is discouraged because
* 1) most web browsers support UTF-8 characters in URLs
* 2) transliteration causes a loss of information
*
* @author Sean Murphy <sean@iamseanmurphy.com>
* @copyright Copyright 2012 Sean Murphy. All rights reserved.
@liverbool
liverbool / bootstrap_4_horizontal_layout.html.twig
Created Mar 22, 2016
bootstrap_4_horizontal_layout.html.twig
View bootstrap_4_horizontal_layout.html.twig
{% use "web:Form:bootstrap_4_layout.html.twig" %}
{# Labels #}
{% block form_label -%}
{% if label is same as(false) %}
<div class="{{ block('form_label_class') }}"></div>
{% else %}
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ block('form_label_class'))|trim}) %}
{{- parent() -}}
@liverbool
liverbool / bootstrap_4_layout.html.twig
Created Mar 22, 2016
bootstrap_4_layout.html.twig
View bootstrap_4_layout.html.twig
{% use "form_div_layout.html.twig" %}
{# Widgets #}
{% block form_widget_simple -%}
{% if type is not defined or 'file' != type %}
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-control')|trim}) -%}
{% endif %}
{{- parent() -}}
{%- endblock form_widget_simple %}
@liverbool
liverbool / php70-apcu.sh
Last active Mar 21, 2016 — forked from TomK/php70-apcu.sh
PHP7 APCU
View php70-apcu.sh
#!/bin/bash
# make sure you switch to php70
brew unlink php56 && brew link php70
# checkout and build
git clone git@github.com:krakjoe/apcu
cd apcu
make clean
@liverbool
liverbool / .bash_profile
Created Mar 12, 2016 — forked from OzzyCzech/.bash_profile
Install NGINX, PHP-FPM (5.5.6), Mongo and MySql
View .bash_profile
#############################################################################
# current prompt
#############################################################################
# \d – Current date
# \t – Current time
# \h – Host name
# \# – Command number
# \u – User name
# \W – Current working directory (ie: Desktop/)
# \w – Current working directory, full path (ie: /Users/Admin/Desktop)
@liverbool
liverbool / gist:4b62ffe3194110a475c8
Last active Aug 27, 2015 — forked from ebuildy/gist:5d4ad0998848eaefdad8
Setup sentry logger on a fresh Ubuntu server
View gist:4b62ffe3194110a475c8
sudo apt-get update
sudo apt-get install python-virtualenv
sudo apt-get install python-dev
sudo apt-get install postgresql
sudo apt-get install postgresql-server-dev-9.3
sudo apt-get install redis-server
sudo -u postgres createuser -s sentry
sudo -u postgres psql -c "alter user sentry with password 'sentry';"
@liverbool
liverbool / basic-mac-dev-setup.sh
Last active Aug 29, 2015
Basic Mac Developer Setup
View basic-mac-dev-setup.sh
# Basic Mac Developer Setup
# =========================
sudo ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" &&\
brew install wget &&\
brew install caskroom/cask/brew-cask &&\
brew cask install google-chrome &&\
brew cask install google-drive &&\
brew cask install git &&\
brew cask install github &&\
View README.md

Tutum Zero Downtime Re-deploy

cats.jpg

I tweeted Tutum last night asking if they're looking at implementing zero downtime re-deploys for a given service. Slightly surprised by their response as it seems like a critical feature if you want to use the service for a production environment.

"not a top priority, but by Spring :)"

As Tutum currently doesn't support graceful termination of containers within a service, I was experiencing a 5-10 second window of 503 errors, so decided to use the following hack (code below) until the feature is officially implemented.

View swap.sh
#!/bin/bash
# https://meta.discourse.org/t/create-a-swapfile-for-your-linux-server/13880
sudo install -o root -g root -m 0600 /dev/null /swapfile
dd if=/dev/zero of=/swapfile bs=1k count=2048k
mkswap /swapfile
swapon /swapfile
echo "/swapfile swap swap auto 0 0" | sudo tee -a /etc/fstab
sudo sysctl -w vm.swappiness=10
echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf
View intb-dev-env.sh
#!/bin/bash
locale-gen en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
echo 'Asia/Bangkok' | sudo tee /etc/timezone
apt-get update
apt-get install -y python-software-properties curl zsh git nodejs npm ruby-dev gem && \
You can’t perform that action at this time.