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
CFLAGS := -O2 -fPIC | |
test: libdontfree.dylib test.swift | |
swiftc -L. -ldontfree test.swift | |
%.o: %.c | |
$(CC) $(CFLAGS) -c -o $@ $^ | |
libdontfree.dylib: dont-free.o | |
$(CC) $(LDFLAGS) -shared -o $@ $^ |
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
@inline(never) | |
func searchSlow(_ haystack: UnsafeBufferPointer<UInt8>, needle: UInt8) -> Int? { | |
print(haystack) | |
return haystack.firstIndex(of: needle) | |
} | |
@inline(never) | |
func searchFast16(_ ptr: UnsafeBufferPointer<UInt8>, needle: UInt8) -> Int? { | |
assert(ptr.count % 16 == 0) |
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
docker run -it --rm --cap-add=SYS_PTRACE --security-opt seccomp=unconfined swift:5.1 bash -c 'echo "print(1)" > /tmp/test.swift && cd /tmp && swiftc test.swift && lldb --batch -o "break set -n main" -o run -o cont ./test' |
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
lldb --batch -o run -k "image list" -k "register read" -k "bt all" -k "exit 134" ./my-program |
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
import Foundation | |
public struct SandwichError: Error, Equatable, CustomStringConvertible { | |
private enum SandwichErrorCode: Int { | |
case tooLittleSalami = 1 | |
case tooLittleMustard | |
case noTomatoes | |
case noBread | |
} |
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
//===----------------------------------------------------------------------===// | |
// | |
// This source file is part of the SwiftNIO open source project | |
// | |
// Copyright (c) 2019 Apple Inc. and the SwiftNIO project authors | |
// Licensed under Apache License v2.0 | |
// | |
// See LICENSE.txt for license information | |
// See CONTRIBUTORS.txt for the list of SwiftNIO project authors | |
// |
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
// | |
// WemoControl.swift | |
// WemoSchedule | |
// | |
// Created by Johannes Weiß on 12/03/2016. | |
// Copyright © 2016 Johannes Weiß. All rights reserved. | |
// | |
import Foundation |
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 <dispatch/dispatch.h> | |
#include <string.h> | |
#include <stdio.h> | |
#include <errno.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
int pipes[2] = {0, 0}; | |
int err = pipe(pipes); |
NewerOlder