Skip to content

Instantly share code, notes, and snippets.

View weissi's full-sized avatar

Johannes Weiss weissi

View GitHub Profile
@weissi
weissi / getaddrinfo-test.c
Created March 13, 2015 17:08
getaddrinfo-test
#ifdef _WIN32
#include <ws2tcpip.h>
#include <in6addr.h>
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#endif

Building

clang -shared -o /tmp/test-dylib.dylib test-dylib.c

Running

export DYLD_INSERT_LIBRARIES=/tmp/test-dylib.dylib

test it

@weissi
weissi / test-mmap-past-eof.c
Last active August 29, 2015 14:19
This `mmap`s a region of a file beyond EOF.
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <unistd.h>
int main()
#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);
//
// WemoControl.swift
// WemoSchedule
//
// Created by Johannes Weiß on 12/03/2016.
// Copyright © 2016 Johannes Weiß. All rights reserved.
//
import Foundation

Swift compiler 4.0, language mode 4

>=4.0.0
NOT >=4.0.10
NOT >=4.0.50
NOT >=4.0.150
NOT >=4.0.200
NOT >=4.0.250
NOT >=4.1.0
//===----------------------------------------------------------------------===//
//
// 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
//
import Foundation
public struct SandwichError: Error, Equatable, CustomStringConvertible {
private enum SandwichErrorCode: Int {
case tooLittleSalami = 1
case tooLittleMustard
case noTomatoes
case noBread
}
@weissi
weissi / run-in-lldb.sh
Created November 13, 2019 10:32
run-in-lldb.sh
lldb --batch -o run -k "image list" -k "register read" -k "bt all" -k "exit 134" ./my-program
@weissi
weissi / xcode-how-to-backtrace.md
Created December 11, 2019 10:03
xcode-how-to-backtrace.md