Skip to content

Instantly share code, notes, and snippets.

View esod's full-sized avatar

Eric Sod esod

View GitHub Profile
### Example #1 ###
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2e23d01384ac iperf-v1:latest "/usr/bin/iperf -s" 10 minutes ago Up 10 minutes 5001/tcp, 0.0.0.0:32768->5201/tcp compassionate_goodall
# Append the container ID (CID) to the end of an inspect
$ docker inspect --format '{{ .NetworkSettings.IPAddress }}' 2e23d01384ac
172.17.0.1
### Example #2 ###
# Add -q to automatically parse and return the last CID created.
@esod
esod / git_status_indicator.sh
Last active October 15, 2020 02:26
Display path, git branch, and status in terminal
# Display path, git branch, and status in terminal
################################################
# Git prompt
# Many thanks to Andy Magoon https://gist.github.com/magoon/6002421
#
# After (branch name), you'll see one or more of
# • uncommitted changes in green
# • unstaged changes in yellow
# • untracked files in blue(ish)
@esod
esod / Preferences.sublime-settings
Last active December 7, 2015 18:48
sublime-settings
{
"caret_extra_width": 1,
"caret_style": "phase",
"close_windows_when_empty": false,
"color_scheme": "Packages/Predawn/predawn.tmTheme",
"theme": "predawn-DEV.sublime-theme",
"predawn_tabs_active_underline": true,
"copy_with_empty_selection": false,
"default_line_ending": "unix",
"drag_text": false,
@esod
esod / gist:586eeae12eb5806a39ec
Created March 17, 2015 19:10
A custom entity / entity_view()
<?php
/**
* Implements hook_entity_info().
*/
function demo_entity_info() {
$info = array();
$info['project'] = array(
@esod
esod / Guzzle and Symfony's finder in Drupal 7 blocks
Last active August 29, 2015 14:16
Guzzle and Symfony's finder in Drupal 7 blocks
{
"name": "esod/d7.local",
"require": {
"guzzlehttp/guzzle": "~5.2",
"symfony/finder": "2.6.6"
},
"authors": [
{
"name": "Eric Sod",
"email": "esod124@gmail.com"
@esod
esod / gist:7876678
Last active December 30, 2015 19:49
Quickly change drush versions.
I wrote a bash function so one doesn't have to go to the git repo to manually change drush versions.
Add these lines to your .bash_profile:
# Switch Drush version at will
function switchdrushto() {
local cwd=$(pwd)
local drush_location="/usr/local/drush"
local checkout_version="git checkout $@"
local drush_version="drush --version"