Skip to content

Instantly share code, notes, and snippets.

In completion.bash line 17:
\find -L "$1" \
^-- SC1001: This \f will be a regular 'f' in this context.
In completion.bash line 25:
\find -L "$1" \
^-- SC1001: This \f will be a regular 'f' in this context.
@Jonty
Jonty / convert_cf_spec.py
Created December 14, 2015 14:12
Converts from cf job spec properties format to something usable with a normal manifest. Horrendous.
import sys
import yaml
import re
import textwrap
data = {}
for k, v in yaml.load(sys.stdin.read())['properties'].items():
prev = data
bits = k.split('.')
for name in bits[:-1]:
@Jonty
Jonty / interleave_list_chunks.py
Created January 22, 2014 19:15
A tiny function for interleaving lists with configurable amounts from each list in each chunk.
def interleave_chunks(lists):
while lists:
items, amount = lists.pop(0)
subset = items[0:amount]
items = items[amount:]
if subset:
for item in subset:
yield item
@Jonty
Jonty / sort.py
Last active December 25, 2015 11:19 — forked from ntlk/sort.py
import sys
lines = sys.stdin.readlines()
lines.sort(reverse = ('-r' in sys.argv))
print ''.join(lines)
@Jonty
Jonty / uniq.py
Created October 12, 2013 20:34 — forked from ntlk/uniq.py
import sys
def process_lines(lines):
for index, line in enumerate(lines):
last_line = lines[index - 1]
if line != last_line:
sys.stdout.write(line)
process_lines(sys.stdin.readlines())
@Jonty
Jonty / iphoto_dupe_filter.applescript
Created December 27, 2014 22:27
An bit of Applescript for use in Automator workflows that takes a list of files and returns a list of files that do not exist in your iPhoto library already, to prevent duplicates being imported.
on run {input, parameters}
set allFiles to input
set newPhotos to {}
tell application "iPhoto"
repeat with aFile in allFiles
try
set fileInfo to info for aFile
set actualFileName to name of fileInfo
set photosFound to get (every photo of album "Photos" whose image filename is actualFileName)
@Jonty
Jonty / gist:5237871
Created March 25, 2013 15:19
Beanstalkd command runner example
import os
import beanstalkc
beanstalk = beanstalkc.Connection(host='localhost', port=14711)
while True:
job = beanstalk.reserve()
print "Running %s" % job.body
os.system(job.body)
job.delete()
properties:
# The domain name for this CloudFoundry deploy
domain: ~
acceptance_tests:
# The Elastic Runtime Application Domain
apps_domain: ~
# The name of the binary buildpack to use in acceptance tests that specify a
# buildpack.
binary_buildpack_name: ~
# Whether to pass the -v flag to cf-acceptance-tests

Voting for descale

  • Multi-oauth library for signin
  • A thing to suggest topics
  • A way to vote things up or down
  • Heroku
  • Any language you like
  • Event
    • Create (and set an end date)
    • End
  • Public, no need to login to read