Skip to content

Instantly share code, notes, and snippets.

View ibomash's full-sized avatar

Illya Bomash ibomash

  • John Wiley & Sons
  • New York, NY, USA
View GitHub Profile
@ibomash
ibomash / python-tabs-transition.el
Created March 13, 2014 14:51
Highlight tabs in current Python buffer, to help transition to spaces. To convert all tabs in the file to spaces, run this untabify-all function.
(require 'whitespace)
(defun python-tabs-transition ()
"Helpers to transition from tabbed Python files to non-tabbed"
(interactive)
(setq tab-width 4)
(setq python-indent-offset 4)
(make-local-variable 'whitespace-style)
(setq whitespace-style '(tabs tab-mark face))
(whitespace-mode)
)
@ibomash
ibomash / pycheckers.sh
Last active August 29, 2015 13:57
Basic Python setup in Emacs
#!/bin/sh
# from http://stackoverflow.com/questions/1259873/how-can-i-use-emacs-flymake-mode-for-python-with-pyflakes-and-pylint-checking-cod
# Put this in your $PATH!
# Run pyflakes to find potential errors, treat results as errors
pyflakes "$1"
# Run pep8 for formatting, treat results as warnings
pep8 --ignore=E101,E127,E128,E221,E701,E202,E501,E225,E261,W191,W293 --repeat "$1" | sed "s/[0-9]*: \([EW]\)/ Warning: \1/"
@ibomash
ibomash / gist:4590250
Created January 21, 2013 22:48
Eric’s AppleScript to work with PDFs in BibDesk
(*
This script finds all pdf, tex, and ps files in your paper directory or subdirectories of that
*)
set start_time to current date
set pubs_with_link to 0
set num_of_links to 0
set matchingFiles to {}
set matchingKeys to {}
@ibomash
ibomash / randomize-test.py
Created September 24, 2012 02:34
Randomize order of text blocks separated by \n\n, and renumber them
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Randomize the text in one of Disan's tests"""
import sys
import random
import re
import argparse
import ast
@ibomash
ibomash / fetch_gmail_messages.py
Created September 15, 2012 19:35
Download messages matching a search using Python and imapclient
# -*- coding: utf-8 -*-
"""Code to fetch Gmail messages matching a particular pattern."""
"""
Run:
python -m imapclient.interact -H imap.gmail.com --ssl -P 993
Then in the interactive session, run:
%run <this file>