Skip to content

Instantly share code, notes, and snippets.

Phil Tysoe igniteflow

Block or report user

Report or block igniteflow

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
@igniteflow
igniteflow / slack-images.py
Created Oct 8, 2018
Download all images from a Slack channel
View slack-images.py
import datetime
import requests
import os.path
TOKEN = 'xxxx-xxxx'
TARGET_DIR = './images/'
@igniteflow
igniteflow / rename-files.md
Last active Apr 18, 2018
Google Drive: fix dotfile renaming
View rename-files.md

Google Drive replaces the leading dot in dot-filenames with an underscore. To undo this after downloading the files as a zip run

  # replaces leading underscores with dots
  rename -n 's/^_/./g' *  # first check
  rename 's/^_/./g' *  # now execute

After downloading the files be sure to set the correct permissions

@igniteflow
igniteflow / .gitautouser
Created Feb 13, 2018
Git auto user. Switch git user/email based on active directory
View .gitautouser
#!/usr/bin/env python
"""
Checks and sets git username and email based on dir root matching
1. Add the following to ~/.bashrc
function cd {
builtin cd "$@"
if [ -d ".git" ] ; then
@igniteflow
igniteflow / python-command-line.md
Last active May 13, 2018
Creating a command-line app with Python
View python-command-line.md
  1. Create a setup.py:
  #!/usr/bin/env python

  from distutils.core import setup

  setup(
      name='My Thing',
      version='1.0',
View git-commands.sh
# pull changes from a single file inside a commit (useful when hotpatching)
git diff ..<hash> -- <filename> | git apply
# view changes in a file historically
git diff 'HEAD@{3 weeks ago}'..HEAD -- foo/my_module.py
# view commits with patches in this branch only (assuming it was branched from master and is up-to-date)
# useful when reviewing tickets
git log master.. --patch --reverse
View linux-commands.md

Linux Commands

Networking

traceroute - print the route packets take to network host

ifconfig - interface configurator. view ip address and mac address

ping - (Packet INternet Groper) test connectivity between two nodes

@igniteflow
igniteflow / connection-issues.md
Created Nov 7, 2016
Debugging connection issues
View connection-issues.md

nmap github.com -p http,git

@igniteflow
igniteflow / mock-object-property.py
Created Oct 3, 2016
How to mock an object property in Python
View mock-object-property.py
import mock
with mock.patch('path.to.ObjectClass.my_property', new_callable=mock.PropertyMock) as mock_my_property:
mock_my_property.return_value = 'my value'
View emoji-wall.py
"""
print out all the emojis to spam your friends Slack clients
"""
import requests
api_token = 'your-api-token'
text = ' '.join([':{}:'.format(e) for e in requests.get('https://slack.com/api/emoji.list?token={}'.format(token)).json()['emoji'].keys()])
print(text)
@igniteflow
igniteflow / python-coverage-xml-parser.coffee
Created May 19, 2016
Python Coverage XML file parser in Coffeescript
View python-coverage-xml-parser.coffee
fs = require 'fs',
xml2js = require 'xml2js'
coverage =
modules: []
filename = 'coverage.xml'
parser = new xml2js.Parser()
fs.readFile __dirname + '/' + filename, (err, data) ->
You can’t perform that action at this time.