This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GitPatchDownloadStrategy < GitDownloadStrategy | |
def initialize name, resource | |
super | |
@baseref = meta[:base] | |
end | |
def stage | |
Homebrew.system("git", "-C", cached_location, "diff", @baseref, @ref) do | |
$stdout.reopen('patch') | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
. "$(git --exec-path)"/git-sh-setup | |
cleanup() { | |
if [ ! -z "$tmp" ]; then | |
rm -rf "$tmp" | |
fi | |
} | |
tmp="" | |
trap cleanup EXIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LocalDirectoryDownloadStrategy < AbstractDownloadStrategy | |
def initialize(name, resource) | |
super | |
@url = @url.sub(%r[^file://], "") | |
end | |
def stage | |
ohai "cp -r #{@url}/* ." | |
cp_r(Dir[@url + "/*"], ".") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <utility> | |
#include <functional> | |
#include <stdio.h> | |
template<class S> class delegate; | |
template<class Ret, class ... Args> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import mysql.connector | |
import getpass | |
import cgi | |
import sys | |
mysqlpass = getpass.getpass("password for mysql: ", sys.stderr) | |
cnx = mysql.connector.connect(user='root', |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def chunks(iterable, n): | |
"""group elements of iterable into chunks of size n and yield an iterator for | |
each chunk""" | |
i = iter(iterable) | |
def groupiter(first): | |
yield first | |
for x in range(n-1): | |
try: | |
yield next(i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import csv | |
from StringIO import StringIO | |
with open('test.csv', 'rb') as f: | |
data = f.read().decode('utf8') | |
# remove unicode byte-order marker if it exists | |
if data.startswith(u'\uFEFF'): | |
data = data[1:] |
OlderNewer