import re | |
from pathlib import Path | |
p = Path("big.txt") | |
t = p.read_text() | |
rgx = re.compile(r"\w+") | |
for _ in range(10): | |
rgx.findall(t) |
Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.
In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.
Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j
#!/bin/bash | |
set -e | |
DEFAULT_MAX_DEPTH=4 | |
DEFAULT_OUTPUT_PATH=./update | |
print_usage() | |
{ | |
echo "$0 [options] TARFILE" | |
echo "options:" |
class Job(): | |
def __init__(self, *args, **kwargs): | |
pass | |
def __call__(self, data): | |
raise NotImplementedError() | |
class Square(Job): | |
def __call__(self, data): | |
return [d * d for d in data] |
#!/bin/bash | |
if [[ "$@" == *'--help'* ]]; then | |
echo "usage: what-i-did [since] [until] [format]" | |
echo ' See `man git-log` for more information' | |
echo " Examples:" | |
echo " what-i-did commits from self since 6am today" | |
echo " what-i-did yesterday commits from self over last 24hrs" | |
echo " what-i-did '6am yesterday' '6pm yesterday'" | |
echo " commits from self between 6am-6pm" |
#!/usr/bin/env python3.6 | |
import os | |
msg = { | |
# 'passed': '✔', | |
'failed': '🗙', | |
'passed': ':heavy_check_mark:', | |
'failed': ':x:', | |
'timed_out': '**T***' |
#!/usr/bin/env python3.6 | |
import json | |
def tripletsWithSum(n): | |
triplets = set() | |
b_limit = int(n / 2) + 1 | |
for a in range(1, n - 2): | |
a2 = a * a | |
n_a = n - a |
#!/bin/bash | |
set -e | |
# CARD=1 | |
PROFILE_BASE=output:analog-stereo | |
DEVICE=usb-Generic_USB_Audio_200901010001-00 | |
CARD_NAME="alsa_card.${DEVICE}" | |
SINK_BASE="alsa_output.${DEVICE}.analog-stereo" | |
# Find card index |
# -*- coding: utf-8 -*- | |
# Uses Python 2.7 | |
import sys | |
reload(sys) | |
sys.setdefaultencoding('utf-8') | |
import requests | |
import json |