Skip to content

Instantly share code, notes, and snippets.

@imtapps
imtapps / cmd.sh
Created October 8, 2015 19:44
Show all files changed in git back to a specified commit
git log --name-only --oneline | sed '/<COMMIT HERE>/q' | grep -v ':'`
@imtapps
imtapps / homebrew.md
Created October 1, 2015 13:56
El Capitan and Homebrew

https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/El_Capitan_and_Homebrew.md#if-usrlocal-does-not-exist

El Capitan & Homebrew

Part of the OS X 10.11/El Capitan changes is something called System Integrity Protection or "SIP".

SIP prevents you from writing to many system directories such as /usr, /System & /bin, regardless of whether or not you are root. The Apple keynote is here if you'd like to learn more.

One of the implications of SIP is that you cannot simply create /usr/local if it is removed or doesn't exist for another reason. However, as noted in the keynote, Apple is leaving /usr/local open for developers to use, so Homebrew can still be used as expected.

@imtapps
imtapps / assigned_seats.py
Last active August 29, 2015 14:24
Assign seats for roundtable discussions at the customer meeting
"""
Sort customers into random tables
Make sure they do not sit at a table with the same people more than once
* 155 customers
* 20 tables
* 6-8 customers at each table
* 6 rounds of switching tables
=====
@imtapps
imtapps / decode.py
Created June 4, 2015 15:29
Decode celery data from djkombu_messages table
"""
This script excepts a data file to contain a single base64 encoded
string - which is the payload from djkombu from the djkombu_message table.
"""
import base64
import cPickle as pickle
def decode(line_number):
@imtapps
imtapps / query.js
Created May 11, 2015 15:49
Mongo Aggregation
db.collection.aggregate([
{ $group: {
_id: { firstField: "$firstField", secondField: "$secondField" },
uniqueIds: { $addToSet: "$_id" },
count: { $sum: 1 }
}},
{ $match: {
count: { $gt: 1 }
}}
])
@imtapps
imtapps / remote_shell_script.py
Last active August 29, 2015 14:16
Execute shell script on remote system
import paramiko
import os
def main(environment):
ssh_config = paramiko.SSHConfig()
with open(os.path.expanduser('~/.ssh/config')) as f:
ssh_config.parse(f)
ssh_params = ssh_config.lookup(environment)
#!/bin/bash
while :;
do
temp=/tmp/outfile
true > $temp
for FILE in *.txt; do
if [[ $(tail -n 1 $FILE) != Finished* ]];
then
echo -en "$(ls -lA $FILE)\n" >> $temp
@imtapps
imtapps / email.py
Created September 11, 2014 19:19
Python email example
from email.mime.text import MIMEText
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from smtplib import SMTP
sender = "someone@gamil.com"
sender_password = 'someones-password'
receiver = "receiver@something.com"
# Create message container
@imtapps
imtapps / commits.md
Last active October 1, 2015 15:59
IMTAPPS Style Guides

Commit Message Prefixes

If you are working on a change that has a ticket number, add it to the commit message!

All commits prefixed with Bug Fix, Feature or Enhancement will be communicated with a non-technical audience. In the rare scenario where you do NOT want to communicate one of the aforementioned commits add a [private] to the commit message. Commit messages with [private] will be communicated with technical audiences only and should match the following format.

Prefix: Here is the message

[private]
@imtapps
imtapps / designer.html
Created August 19, 2014 12:43
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<polymer-element name="my-element">