Skip to content

Instantly share code, notes, and snippets.

Luke Griffiths Sporky023

  • Cambridge, MA
View GitHub Profile
@Sporky023
Sporky023 / docker-cleanup-resources.md
Last active Nov 26, 2018 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks
View docker-cleanup-resources.md

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
@Sporky023
Sporky023 / bash_ps1_display_two_levels_of_pwd_context.sh
Created Jan 2, 2017
bash / PS1 / display two levels of pwd context
View bash_ps1_display_two_levels_of_pwd_context.sh
# thanks: https://muffinresearch.co.uk/showing-last-two-directories-of-pwd-in-bash-prompt/
function PWD {
pwd | sed 's/^\/Users\/<YOUR_USERNAME>/~/' | awk -F\/ '{print $(NF-1),$(NF)}' | sed 's/ /\//' | sed 's/~\/~/~/'
}
export PS1="\u\[\e[m\]:\[\e[36m\]\$(PWD)\[\e[m\] "
# backslash before $ tells it to run the function each time;
# else it is only run once and won't update as you switch directories
View js_nested_fields_example.md

in your form.html.haml

  $(document).on('click', '.add_an_aol_field', function(){
    $aol_field = $('#aol_selector_template').html();

    $('.aol_fields').append($aol_field);
  });
@Sporky023
Sporky023 / gist:9ce9cf0767277104d77a
Created Dec 16, 2014
vimrc leader mappings for CtrlP
View gist:9ce9cf0767277104d77a
nmap <Leader>ae :CtrlP<CR>
nmap <Leader>av :vs<CR>:CtrlP<CR>
nmap <Leader>as :sp<CR>:CtrlP<CR>
nmap <Leader>at :tabe<CR>:CtrlP<CR>
View gist:1e02f68941545ee93858

how to deploy app.vencaf.org to heroku

step 1: create a local copy (assumes you have git installed)

option A: get the code from github

visit github.com/vencaf/theapp in browser
on right side of page, click to save the "clone url"

git clone [paste clone url]

View gist:4195529
"find potential suppliers for the pen thing"
* background:
* I want to sell the following product:
* a gag pen that cannot write
* both ends are the "inactive" end of the pen
* see these drawings: http://imgur.com/6DKTD
* Based on the simplicity of my design, I believe that any place which currently manufactures pens should be able to manufacture this, using existing parts on hand. However, I haven't had any luck with alibaba.com so far. I've gotten 3 quotes through alibaba.com, but they are very bad quality. I may want to contact these manufacturers more directly.
@Sporky023
Sporky023 / gist:3746265
Created Sep 18, 2012
admin_sends_offer_as_completely_new_company
View gist:3746265
Log in as admin
click "Admin"
click "Create New Company"
fill in company form
click "Save and add location"
fill in location form
click "Save and add another location"
fill in location form
click "Save and add an employee"
fill in employee form
View openbay_state_transitions.txt
Non-indented lines show actions take by users.
Indented lines show resulting states of various records.
Everything is from SP's point of view:
[P, C, or S] (P)ending, (C)losed, (S)ettled. Which list to show Offer on under "Manage Offers"
[A, C] (A)ctive, (C)losed. Which list to show Service Request on.
SCENARIO 1: VO withdraws offer
VO: create service_request_1
service_request_1: 'Active, N days remaining' - A
@Sporky023
Sporky023 / gist:3611463
Created Sep 3, 2012
traceroute to PT assets
View gist:3611463
~ $ traceroute cdn3-pivotaltracker.pantherssl.com
traceroute: Warning: cdn3-pivotaltracker.pantherssl.com has multiple addresses; using 66.114.52.15
traceroute to cdn-pivotaltracker.pantherssl.com.cdngc.net (66.114.52.15), 64 hops max, 52 byte packets
1 172.16.0.2 (172.16.0.2) 1.155 ms 0.616 ms 0.849 ms
2 core-1.cictr.com (204.9.220.34) 1.350 ms 0.918 ms 0.883 ms
3 ge-0-3-2-7-3600-sur01.cambridge.ma.boston.comcast.net (107.0.92.209) 3.757 ms 3.509 ms 4.271 ms
4 te-0-9-0-6-ar01.needham.ma.boston.comcast.net (68.85.106.29) 3.121 ms 5.876 ms 3.666 ms
5 he-2-9-0-0-cr01.newyork.ny.ibone.comcast.net (68.86.90.57) 11.355 ms 18.006 ms 10.235 ms
6 xe-7-0-3.edge1.newyork2.level3.net (4.71.186.41) 7.679 ms 7.572 ms 10.289 ms
7 vlan51.ebr1.newyork2.level3.net (4.69.138.222) 7.741 ms 7.456 ms 7.547 ms
View gist:3229744
BACKGROUND:
We're changing the offer form a bit to have a new set of fields for each line item in the offer. Therefore we need to change the set of columns in the database table that stores these line items. Old data will need to be modified to fit the new format. This document outlines an algorithm for modifying the old data into the new format.
EXISTING COLUMNS
* description
* quantity
* part_price (unit price per part)
You can’t perform that action at this time.