Author: Chris Lattner
import sys | |
from subprocess import call | |
import json | |
import os | |
import requests | |
def download_gists(gists: list): | |
for gist in gists: | |
call(["git", "clone", gist["git_pull_url"]]) |
## Install perf in docker container | |
### ubuntu 18.4 | |
### kernel 4.14.173-137.229.amzn2.x86_64 | |
docker exec -it {containerid} sh | |
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.14.173.tar.xz && tar -xf ./linux-4.14.173.tar.xz && cd linux-4.14.173/tools/perf/ && apt -y install flex bison && make -C . && make install | |
./perf | |
./perf list | |
./perf bench mem all |
- Proposal: SE-XXXX
- Authors: Chris Lattner, Joe Groff
Modern Cocoa development involves a lot of asynchronous programming using closures and completion handlers, but these APIs are hard to use. This gets particularly problematic when many asynchronous operations are used, error handling is required, or control flow between asynchronous calls gets complicated. This proposal describes a language extension to make this a lot more natural and less error prone.
This paper introduces a first class Coroutine model to Swift. Functions can opt into to being async, allowing the programmer to compose complex logic involving asynchronous operations, leaving the compiler in charge of producing the necessary closures and state machines to implement that logic.
# first: mkdir user && cd user && cp /path/to/get_gists.py . | |
# python3 get_gists.py user | |
import requests | |
import sys | |
from subprocess import call | |
user = sys.argv[1] | |
r = requests.get('https://api.github.com/users/{0}/gists'.format(user)) |
// | |
// Copyright © 2016 Tanner Bennett. All rights reserved. | |
// | |
import Foundation | |
typealias ResponseParserBlock = (ResponseParser) -> Void | |
class ResponseParser { | |
import Foundation | |
/** | |
Run an incremental counter, but return only the values that survive the "lucky number" process. | |
The process is to list all the positive integers, then filter out entries in stages. For all the numbers in a stage, let *N* be the first unfiltered number that is neither 1 nor been already been used as a filter seed for a previous stage, and filter out every Nth number. The first pass uses 2 and therefore filters out every second number, i.e. the even numbers. The second pass uses 3 and therefore filters out every third number that survived the 2-stage. The third pass uses 7 and therefore filters out every seventh number that survived both the 2- and 3-stages. The fourth pass uses 9 and therefore filters out every ninth number that survived the 2-, 3-, and 7-stages. (Note that 2 is the only seed that eliminates itself in its filter. Some definitions of lucky numbers avoid this irregularity by starting with the odd positive integers.) | |
*/ | |
public struct LuckyNumberGenerator<C |
// Would you rather use this: | |
NSLayoutConstraint(item: label, attribute: .Leading, relatedBy: .Equal, toItem: button, attribute: .Trailing, multiplier: 1, constant: 0).active = true | |
// or this? | |
label.constrain(.Leading, .Equal, to: button, .Trailing, plus: 20) | |
Here's my own list of the interesting stuff announced during this year's WWDC, collected from the keynotes, various Apple docs, blog posts and tweets.
If you're planning to watch the videos, I really recommend this Mac app that helps you download and watch them: https://github.com/insidegui/WWDC.
http://www.apple.com/osx/elcapitan-preview/
- split view - two apps side by side on full screen